allure-jasmine
TypeScript icon, indicating that this package has built-in type declarations

3.0.0-beta.1 • Public • Published

allure-jasmine

Allure integration Jasmine framework

Allure Report logo


Installation

Use your favorite node package manager to install required packages:

npm add -D allure-jasmine

Create spec/helpers/setup.ts file with following content:

const AllureJasmineReporter = require("allure-jasmine");

const reporter = new AllureJasmineReporter();

jasmine.getEnv().addReporter(reporter);

Check that the helper matches with helper field in your spec/support/jasmine.json file.

Use Allure runtime Api

The plugin provides custom commands which allow to add additional info inside your tests:

import { epic, attachment, parameter } from "allure-js-commons";

it("my test", async () => {
  await attachment("Attachment name", "Hello world!", "text/plain");
  await epic("my_epic");
  await parameter("parameter_name", "parameter_value", {
    mode: "hidden",
    excluded: false,
  });
});

Links usage

import { link, issue, tms } from "allure-js-commons";

it("basic test", async () => {
  await link("https://allurereport.org", "link type", "Allure Report");
  await issue("https://github.com/allure-framework/allure-js/issues/352", "Issue Name", );
  await tms("https://github.com/allure-framework/allure-js/tasks/352", "Task Name");
});

You can also configure links formatters to make usage much more convenient. %s in urlTemplate parameter will be replaced by given value.

```ts
const AllureJasmineReporter = require("allure-jasmine");

const reporter = new AllureJasmineReporter({
+  links: [
+    {
+      type: "issue",
+      urlTemplate: "https://example.org/issues/%s",
+      nameTemplate: "Issue: %s",
+    },
+    {
+      type: "tms",
+      urlTemplate: "https://example.org/tasks/%s"
+    },
+    {
+      type: "custom",
+      urlTemplate: "https://example.org/custom/%s"
+    },
+  ],
});

jasmine.getEnv().addReporter(reporter);

Then you can assign link using shorter notation:

import { link, issue, tms } from "allure-js-commons";

it("basic test", async () => {
  await issue("351");
  await issue("352", "Issue Name");
  await tms("351");
  await tms("352", "Task Name");
  await link("custom", "352");
  await link("custom", "352", "Link name");
});

Steps usage

The integration supports Allure steps, use them in following way:

import { step } from "allure-js-commons";

it("my test", async () => {
  await step("foo", async () => {
    await step("bar", async () => {
      await step("baz", async () => {});
    });
  });
});

/allure-jasmine/

    Package Sidebar

    Install

    npm i allure-jasmine

    Weekly Downloads

    1,876

    Version

    3.0.0-beta.1

    License

    Apache-2.0

    Unpacked Size

    74.9 kB

    Total Files

    19

    Last publish

    Collaborators

    • qameta-bot
    • baev
    • eroshenkoam