Allure integration for
hermione@^8.x.x
and above
- Learn more about Allure Report at https://allurereport.org
- 📚 Documentation – discover official documentation for Allure Report
- ❓ Questions and Support – get help from the team and community
- 📢 Official annoucements – be in touch with the latest updates
- 💬 General Discussion – engage in casual conversations, share insights and ideas with the community
Use your favorite node package manager to install required packages:
npm add -D hermione-allure allure-js-commons
Add hermione-allure
field to plugins
in your .hermione.conf.js
file:
module.exports = {
plugins: {
+ "hermione-allure": {
+ resultsDir: "./allure-results",
+ links: [
+ {
+ type: "issue",
+ urlTemplate: "https://example.org/issue/%s",
+ },
+ {
+ type: "tms",
+ urlTemplate: "https://example.org/task/%s",
+ },
+ ],
+ }
}
}
The plugin provides custom browser commands which allow to add additional info inside your tests:
import { expect } from "chai";
import { allure } from "hermione-allure/runtime";
it("my test", async ({ browser, currentTest }) => {
await browser.url("https://www.example.org/");
await browser.$("#btn").click();
const screenshot = await browser.takeScreenshot();
await allure(currentTest).attachment(screenshot, "image/png");
await allure(currentTest).epic("my_epic");
await allure(currentTest).parameter("parameter_name", "parameter_value", {
mode: "hidden",
excluded: false,
});
expect(browser.url).not.eq("https://www.startpage.com/");
});
Don't forget to pass current test id as first argument to command!
Change your test case name on custom value on the fly using displayName
method:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).displayName("my test custom name");
});
Provide description in markdown or html syntax:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).description("my **markdown description**");
await allure(currentTest).descriptionHtml("<p>my <b>html description</b></p>");
});
Markup you tests with labels using low-level label
method:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ browser, currentTest }) => {
await allure(currentTest).label("label_name", "label_value");
});
Or using aliases: id
, epic
, feature
, story
, suite
, parentSuite
, subSuite
,
owner
, severity
, tag
:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).epic("my_epic");
});
Add any link by low-level link
method:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).link("http://example.org", "my_link_name", "my_link_type");
});
Or using aliases: issue
, tms
:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).issue("http://example.org", "my_link_name");
await allure(currentTest).tms("http://example.org", "my_link_name");
});
If you configured links templates you can use shorter syntax of links as well:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).issue("1");
await allure(currentTest).issue("2", "Issue name");
await allure(currentTest).tms("1");
await allure(currentTest).tms("2", "Task name");
});
Test parameters can be added by parameter
method:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).parameter("param_name", "param_value", {
excluded: false,
});
});
Attach any file as string or buffer using attachment
method:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).attachment(JSON.stringify({ foo: "bar" }), "application/json", "Attachment name");
});
If you want to attach a screenshot generated in tests, you can use the same method:
import { allure } from "hermione-allure/runtime";
it("adds screenshots", async ({ browser, currentTest }) => {
const screenshot = await browser.takeScreenshot();
await allure(currentTest).attachment(screenshot, "image/png");
});
The reporter provides step
method to add steps inside your tests for better structure:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ browser, currentTest }) => {
await allure(currentTest).step("first step name", async () => {
await allure(currentTest).step("second step name", async () => {
await allure(currentTest).step("third step name", async () => {
// all labels and links will be added to the test, not the step
await allure(currentTest).label("foo", "bar");
// attachments and parameters will be added to the step, not the test
await allure(currentTest).parameter("baz", "qux");
await allure(currentTest).attachment("attachment content", "text/plain");
});
});
});
});
You can reassign history ID for the test case using historyId
method:
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).historyId("my_history_id");
});
import { allure } from "hermione-allure/runtime";
it("my test", async ({ currentTest }) => {
await allure(currentTest).testCaseId("my_id");
});