Closed just-boris closed 7 months ago
I want to add a file with the current test on an afterEach
afterEach(function () {
allure.attachment('File att', 'File Data', ContentType.TEXT);
allure.testAttachment('File tatt', 'File Data', ContentType.TEXT);
allure.createAttachment('File catt', 'File Data', ContentType.TEXT);
});
Opening the allure-results
folder I can see the attachment was created, but the test doesn't have the files. I guess the problem is that the afterEach
hook is treated as another test case and this test case is not generated causing the attachment that created not to be link to a test case.
What we want is something like the following:
describe('Suite Name', function () {
before(function () {
allure.tag('first');
allure.tag('before');
});
after(function () {
allure.tag('last');
allure.tag('after');
});
beforeEach(function () {
allure.tag('beforeEach');
});
afterEach(function () {
allure.tag('afterEach');
});
it('Test One', function () {
allure.issue('1', 'https://www.example.com?issue=1');
});
it('Test Two', function () {
allure.issue('2', 'https://www.example.com?issue=2');
});
it('Test Three', function () {
allure.issue('3', 'https://www.example.com?issue=3');
});
});
Notes:
after
hook should work as soon as #138 is merged and a new version is released.
In terms of before
hook, there's an issue in Mocha (https://github.com/mochajs/mocha/issues/4266) which adds a confusion to the current codebase. So at least we should wait until it's fixed.
I'm submitting a ...
What is the current behavior?
Currently, all steps and attachments in
before
andafter
sections are getting ignored. We should provide an ability to record them to the report.What is the expected behavior?
this code should work, attachment added to the report.
Please tell us about your environment:
Other information
[//]: # ( . e.g. detailed explanation, stacktraces, related issues, suggestions . how to fix, links for us to have more context, eg. Stackoverflow, Gitter etc )