Skip to content

TestNG allure generate 2 results instead of 1 due to an error in tearUp method #316

Closed

Description

@choojoykin

I'm submitting a ...

  • [X ] bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

When tearUp method in Before* annotations throw an error or asserted by assertion allure-testng 2.9.0 generates 2 result jsons. First contains "status":"skipped" and name of the test method, second contains "status":"broken" and name of the before method name. Also its generates 2 container jsons:
first -
{"name":"before","status":"broken","statusDetails":{"known":false,"muted":false,"flaky":false,"message":"Runtime example","trace":"java.lang.RuntimeException: Runtime example\r\n\tat "},"stage":"finished","steps":[],"attachments":[],"parameters":[],"start":1548920224593,"stop":1548920224594,"uuid":"863d9809-b96c-42bd-8ebe-470e55207b71","historyId":"9c323c8a565f93b9c6cb91f2a22feda","fullName":"debug.AllureTest.before","labels":[{"name":"package","value":"debug.AllureTest"},{"name":"testClass","value":"debug.AllureTest"},{"name":"testMethod","value":"beforeClass"},{"name":"parentSuite","value":"Default Suite"},{"name":"suite","value":""},{"name":"subSuite","value":"debug.AllureTest"},{"name":"host","value":""},{"name":"thread","value":""},{"name":"framework","value":"testng"},{"name":"language","value":"java"}],"links":[]}
second -
{"uuid":"714bc018-82c1-496f-8e66-7458248c02c1","name":"","children":["53a13c6d-81ee-46a9-8cd5-7b2c6fa9dec2"],"befores":[{"name":"before","status":"broken","statusDetails":{"known":false,"muted":false,"flaky":false,"message":"Runtime example","trace":"java.lang.RuntimeException: Runtime example\r\n\tat "},"stage":"finished","description":"","steps":[],"attachments":[],"parameters":[],"start":1548920224517,"stop":1548920224526}],"afters":[],"links":[],"start":1548920224495,"stop":1548920224851}
Its doesnt reproduce in allure-testng ver 2.8.0

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

`
public class AllureTest {

@BeforeTest //all before annotations can reproduce this bug
private void before() {
    /*U can use assertion or throwing error*/
    Assert.fail("Before class failed");
    throw new RuntimeException("Runtime example");
}

@Test
public void test() {
    //
}

}
`

What is the expected behavior?

1 test suite with status skipped with logging error or assertion in setUp/tearUp block

Please tell us about your environment:

Allure version 2.9.0
Test framework testng@6.14.3
Allure integration allure-testng@2.9.0
Generate report using allure-maven@2.9

Other information

testng-results.xml contains this information about run -
<testng-results skipped="1" failed="0" ignored="0" total="1" passed="0"> <class name="debug.AllureTest"> <test-method status="FAIL" signature="before()[pri:0, instance:debug.AllureTest@62566842]" name="before"...> <test-method status="SKIP" signature="test()[pri:0, instance:debug.AllureTest@62566842]" name="test"...> </class>

Activity

  1. baev commented on Feb 12, 2019

    @baev
    Member

    @choojoykin

    The only way to display error in Allure is create fake test result, so it the change was introduced via #274 to fix #205 (reported by you) and #135

    Closed as won't fix

  2. added theissue type on Jul 10, 2026
  3. removed
    pr:bugSomething isn't working
    on Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions