Allure framework integration for CodeceptJS
- 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
npm i -D allure-codeceptjs
Add the allure plugin inside you plugins section of your CodeceptJS config file.
For instance the config file is codecept.config.(js|ts)
then:
module.exports.config = {
plugins: {
// ...
allure: {
enabled: true,
require: "allure-codeceptjs",
},
// ...
}
};
Right now you can access allure API through codeceptjs container.
import { label, tag, tags, issue, owner, layer, allureId, description, story, feature, epic, attachment } from "allure-js-commons";
Feature("login-feature");
Scenario("login-scenario1", async () => {
await label("name", "value");
await tag("tag1");
await tags("tag2", "tag3");
await issue("issueName", "google.com");
await owner("eroshenkoam");
await layer("UI");
await allureId("228");
await description("aga");
await story("aga");
await feature("aga");
await epic("aga");
await attachment("data.txt", "some data", "text/plain");
});
You can also use tags to manage labels on scenarios.
import { link, issue, tms } from "allure-js-commons";
Feature("login-feature");
Scenario("login-scenario1", async () => {
await link("link_type", "https://allurereport.org", "Allure Report");
await issue("Issue Name", "https://github.com/allure-framework/allure-js/issues/352");
await tms("Task Name", "https://github.com/allure-framework/allure-js/tasks/352");
});
You can also configure links formatters to make usage much more convenient. %s
in urlTemplate
parameter will be replaced by given value.
module.exports.config = {
// ...
plugins: {
allure: {
enabled: true,
require: "allure-codeceptjs",
+ links: [
+ {
+ type: "${LinkType.ISSUE}",
+ urlTemplate: "https://example.org/issues/%s",
+ nameTemplate: "Issue: %s",
+ },
+ {
+ type: "${LinkType.TMS}",
+ urlTemplate: "https://example.org/tasks/%s",
+ }
+ ]
},
},
// ...
};
Then you can assign link using shorter notation:
import { link, issue, tms } from "allure-js-commons";
Feature("login-feature");
Scenario("login-scenario1", 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");
});
You also can mark up your tests with Allure metadata using CodeceptJS tags API.
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.id:228");
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.label.{{labelName}}:{{labelValue}}");
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.label.story:storyName");
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.label.suite:suiteName");
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.label.owner:ownerName");
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("@allure.label.tag:tagName");
or keep it simple:
Feature("login-feature");
Scenario("login-scenario1", async () => {
// your test
}).tag("tagName");