testng-team / testng

TestNG testing framework
https://testng.org
Apache License 2.0
1.99k stars 1.02k forks source link

All tests are displayed with the first test methods after running the first test itself #2136

Closed sebinjqburst closed 4 years ago

sebinjqburst commented 5 years ago

TestNG Version 7.0.0

Note: only the latest version is supported

Expected behavior

Till 7.00-beta1, when I run my test, the first test will be displayed with the methods listed under the same and the second test will be having the methods defined under the second test alone.

Actual behavior

In 7.0.0, after the first test, the methods under them will be displayed and then lists all the other test names with the methods of the first test listed under those names.

Is the issue reproductible on runner?

Test case sample

Please, share the test case (as small as possible) which shows the issue XML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="NAPA TBAR Automation" configfailurepolicy="continue">
     <listeners>
        <listener class-name="main.java.com.listener.Listener"/>
     </listeners>
    <parameter name="deviceName" value="iPad Air 2"/>
    <parameter name="UDID" value=""/>
    <parameter name="platformVersion" value="12.4"/>
    <parameter name="URL" value="127.0.0.1:1234/wd/hub"/>
    <parameter name="mode" value="QA"/>

    <test verbose="2" name="Regression 1 - Case Registry">
        <classes>
            <class name="main.java.com.testcases.LoginTest">
                <methods>
                    <include name="verifyInvalidlogin"></include> 
                    <include name="verifyValidlogin"></include> 
                </methods>
            </class>
            <class name="main.java.com.testcases.SelectLocationTest">
                <methods>
                    <include name="verifySelectLocation"></include> 
                </methods>
            </class> 
        </classes>  
    </test>

    <test verbose="2" name="Regression 2 - Add Case">
        <classes>
            <class name="main.java.com.testcases.AddCaseTest">
                <methods>
                    <include name="verifyAddCase"></include>
                </methods>
            </class>
            <class name="main.java.com.testcases.PatientInfoTest">
                <methods>
                     <include name="verifyScreenAccessibilty"></include> 
                     <include name="verifyCDSoption"></include> 
                     <include name="verifyPreopCheckout"></include> 
                </methods>
            </class>    
        </classes>  
    </test> 
</suite>

Output after the first test:

PASSED: verifyInvalidlogin
PASSED: verifyValidlogin
PASSED: verifySelectLocation

===============================================
    Regression 1 - Case Registry
    Tests run: 3, Failures: 0, Skips: 0
===============================================

PASSED: verifyInvalidlogin
PASSED: verifyValidlogin
PASSED: verifySelectLocation

===============================================
    Regression 2 - Add Case
    Tests run: 3, Failures: 0, Skips: 0
===============================================

Not sure whether the same is a bug or not, please help if I'm missing some config changes to be done as part of 7.0.0 upgrade.

krmahadevan commented 5 years ago

@sebinjqburst - Please include a complete sample that can be used to reproduce the issue, else we would have to close this issue.

Whatever you have shared currently is not enough sufficient to debug the problem.

krmahadevan commented 5 years ago

No response from the user. Closing this issue. If this is still a problem, please add a comment with a standalone test that can be used to reproduce the problem.

sebinjqburst commented 4 years ago

@krmahadevan Please find a sample project for reproducing the issue mentioned. https://github.com/sebinjqburst/testngdebug

The issue is in the console alone and not in any of the result files generated. The result in console I'm getting for the above project is:

First Test
PASSED: testOne

===============================================
    FirstTest
    Tests run: 1, Failures: 0, Skips: 0
===============================================

PASSED: testOne

===============================================
    SecondTest
    Tests run: 1, Failures: 0, Skips: 0
===============================================

Second Test
PASSED: testOne
PASSED: testTwo

===============================================
    SecondTest
    Tests run: 2, Failures: 0, Skips: 0
===============================================

===============================================
ARIS automation testing
Total tests run: 2, Passes: 2, Failures: 0, Skips: 0
===============================================
krmahadevan commented 4 years ago

@sebinjqburst - Can you please help explain a bit ? I didn't quite understand the issue in the console output.

sebinjqburst commented 4 years ago

@krmahadevan I have only two tests that are declared on two different classes. But the console output shows a total of 3 tests.

First Test
PASSED: testOne

===============================================
    FirstTest
    Tests run: 1, Failures: 0, Skips: 0
===============================================

Second Test
PASSED: testOne

===============================================
    SecondTest
    Tests run: 1, Failures: 0, Skips: 0
===============================================

Second Test
PASSED: testOne
PASSED: testTwo

===============================================
    SecondTest
    Tests run: 2, Failures: 0, Skips: 0
===============================================

The expected output is:

First Test
PASSED: testOne

===============================================
    FirstTest
    Tests run: 1, Failures: 0, Skips: 0
===============================================

Second Test
PASSED: testTwo

===============================================
    SecondTest
    Tests run: 1, Failures: 0, Skips: 0
===============================================
krmahadevan commented 4 years ago

As part of fixing https://github.com/cbeust/testng/issues/2220 this issue also stands fixed and the fix will be available in the upcoming version of TestNG (Whatever version gets released after 7.1.0)