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

[Junit 5] Steps are missing in report in case if test failed in @BeforeAll()

Open Legionivo opened this issue 4 years ago • 4 comments

I'm submitting a ...

  • [X] bug report

What is the current behavior?

Report is empty If test fails in method under @BeforeAll() annotation. allure-results folder contain data, but this data is not displayed in final html report. See screenshots below as example.

What is the expected behavior?

Methods annotated with @BeforeAll() annotation should be processed and displayed in report the same as methods annotated with @BeforeEach() annotation.

Please tell us about your environment:

Allure version 2.13.2
Test framework [email protected]
Allure integration [email protected]

Other information

@BeforeAll() Screenshot from 2020-05-20 12-27-39

@BeforeEach()

Screenshot from 2020-05-20 12-32-53

Legionivo avatar May 20 '20 10:05 Legionivo

@Legionivo did you find any workaround for this issue?

mszajowskiwr avatar Aug 26 '20 11:08 mszajowskiwr

@Legionivo did you find any workaround for this issue?

Hello, nope, I didn't, because I did not try to search workaround.

Legionivo avatar Aug 26 '20 15:08 Legionivo

Looks like JUnit5 not fully supported :( It's a must if you run functional regression tests.

zferenczik avatar Aug 13 '21 06:08 zferenczik

It looks like it is happening because of missing child (container -> result) reference in test container json file.

I was able to get it working correctly by modifying io.qameta.allure.junitplatform.AllureJunitPlatform#stopTestContainer method. I commented the following if there:

//        if (testIdentifier.isTest()) {
            getTest(testIdentifier).ifPresent(children::add);
//        }

I'm not sure yet if this change will break something else or not, but existing junits in allure-junit-platform module are passing.

martinsefcik avatar Jul 19 '22 21:07 martinsefcik

I'm not sure yet if this change will break something else or not, but existing junits in allure-junit-platform module are passing.

Yep, also helped me: now in report saw steps&attachments when "test broken"

S-Kerrigan avatar Oct 27 '22 05:10 S-Kerrigan

It looks like it is happening because of missing child (container -> result) reference in test container json file.

I was able to get it working correctly by modifying io.qameta.allure.junitplatform.AllureJunitPlatform#stopTestContainer method. I commented the following if there:

//        if (testIdentifier.isTest()) {
            getTest(testIdentifier).ifPresent(children::add);
//        }

I'm not sure yet if this change will break something else or not, but existing junits in allure-junit-platform module are passing.

@martinsefcik @S-Kerrigan Can you tell me how you solved the problem in more detail? I don't understand how to do it..

korpus95 avatar Jan 22 '23 16:01 korpus95

@korpus95 I didn't solve the problem, I just proposed what needs to be changed in allure-java library to fix it.

martinsefcik avatar Jan 22 '23 16:01 martinsefcik

@Legionivo Have you found a way to solve the problem?

korpus95 avatar Jan 22 '23 16:01 korpus95

@Legionivo I checked, the problem is solved

korpus95 avatar Feb 07 '23 15:02 korpus95