allure-js icon indicating copy to clipboard operation
allure-js copied to clipboard

[allure-mocha] - How can I add a label/epic/feature/story to a programmatically skipped test?

Open hananmalka opened this issue 2 years ago • 3 comments

Hi, I tried to add some allure properties to a test which I want to skip programmatically.

I can see that the skip actions override all allure properties I have added (In this case epic)

const runtime = require('allure-mocha/runtime');

it("Want this test to contain some epic", function () {
     runtime.allure.epic("Test 1");
     this.skip();
});

The output I get is the following (without the epic, or any other allure property I tried to add):

{
  "uuid": "820c5f46-bbef-43db-88d0-152d325657fb",
  "historyId": "12660b30ea57b0f70968924b25b2f0c5",
  "status": "skipped",
  "statusDetails": { "message": "Test ignored" },
  "stage": "finished",
  "steps": [],
  "attachments": [],
  "parameters": [],
  "labels": [{ "name": "parentSuite", "value": "Modules" }],
  "links": [],
  "start": 1656235569510,
  "name": "Want this test to contain some epic",
  "fullName": "Want this test to contain some epic",
  "stop": 1656235569510
}

How can I add any property for skipped tests?

hananmalka avatar Jun 26 '22 09:06 hananmalka

any update?

hananmalka avatar Jun 30 '22 14:06 hananmalka

plus (for allure-playwright) if test skip manually (test.skip) or skips on fail in serial describe (test.describe.serial)

allure fields for skips tests will be lost

gayvoronskaya avatar Jul 19 '22 13:07 gayvoronskaya

Hello! Sorry for late reply, but the solution can't be done without a PR mochajs/mocha#4922. The issue strongly relates to #486 and requires the same conditions for the solution

epszaw avatar Oct 17 '22 09:10 epszaw