-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testng-results xml reports config skips from base classes as ignored #2886
Comments
@mgesreha - Please attach a sample project that can be used by us to reproduce the problem. |
@krmahadevan |
@mgesreha - I am not sure I quite understand what the issue is. In total there are 3 Here's how the emailable reports look like Here's how the html reports look like Here's how the IntelliJ console output looks like SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Kpi1
Kpi2
mocktest1
PASSED: platform.kpi.KpiTest.testClinicalKpiAlphabeticalSorting
PASSED: platform.kpi.KpiTest.testOperationalKpiAlphabeticalSorting
PASSED: platform.kpi.mockTest.mocktest1
===============================================
C:/CX/Candidates/CXP-Test-Automation/src/test/java/platform/kpi/KpiTest.java
Tests run: 3, Failures: 0, Skips: 0
===============================================
===============================================
All Test Suite
Total tests run: 3, Passes: 3, Failures: 0, Skips: 0
===============================================
Process finished with exit code 0
Here's the console output when I run [INFO] --- surefire:2.22.2:test (default-test) @ CXP-Test-Automation ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Kpi1
Kpi2
mocktest1
PASSED: platform.kpi.KpiTest.testOperationalKpiAlphabeticalSorting
PASSED: platform.kpi.mockTest.mocktest1
PASSED: platform.kpi.KpiTest.testClinicalKpiAlphabeticalSorting
===============================================
C:/CX/Candidates/CXP-Test-Automation/src/test/java/platform/kpi/KpiTest.java
Tests run: 3, Failures: 0, Skips: 0
===============================================
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.857 s - in TestSuite
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.303 s
[INFO] Finished at: 2023-03-19T18:53:34+05:30
[INFO] ------------------------------------------------------------------------ The emailable reports and the html reports are the same as earlier even when run via maven command line. So can you help me understand what is the problem and what is the expectation ? Also please update the sample project to remove off all 3rd party libraries (I see that you have playright). |
@krmahadevan
<?xml version="1.0" encoding="UTF-8"?>
<testng-results ignored="2" total="5" passed="3" failed="0" skipped="0">
<reporter-output>
</reporter-output>
<suite started-at="2023-03-19T09:05:45 CET" name="All Test Suite" finished-at="2023-03-19T09:05:47 CET" duration-ms="1179">
<groups>
</groups>
<test started-at="2023-03-19T09:05:45 CET" name="C:/CX/Candidates/CXP-Test-Automation/src/test/java/platform/kpi/KpiTest.java" finished-at="2023-03-19T09:05:47 CET" duration-ms="1179">
<class name="platform.kpi.mockTest">
<test-method is-config="true" signature="createContextAndPage()[pri:0, instance:platform.kpi.mockTest@f202d6d]" started-at="2023-03-19T09:05:46 CET" name="createContextAndPage" finished-at="2023-03-19T09:05:47 CET" duration-ms="258" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- createContextAndPage -->
<test-method signature="mocktest1()[pri:0, instance:platform.kpi.mockTest@f202d6d]" started-at="2023-03-19T09:05:47 CET" name="mocktest1" finished-at="2023-03-19T09:05:47 CET" duration-ms="3" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- mocktest1 -->
<test-method is-config="true" signature="closeContext()[pri:0, instance:platform.kpi.mockTest@f202d6d]" started-at="2023-03-19T09:05:47 CET" name="closeContext" finished-at="2023-03-19T09:05:47 CET" duration-ms="11" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- closeContext -->
</class> <!-- platform.kpi.mockTest -->
<class name="platform.kpi.KpiTest">
<test-method is-config="true" signature="launchBrowser()[pri:0, instance:platform.kpi.KpiTest@5b12012e]" started-at="2023-03-19T09:05:40 CET" name="launchBrowser" finished-at="2023-03-19T09:05:45 CET" duration-ms="5689" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- launchBrowser -->
<test-method is-config="true" signature="createContextAndPage()[pri:0, instance:platform.kpi.KpiTest@5b12012e]" started-at="2023-03-19T09:05:46 CET" name="createContextAndPage" finished-at="2023-03-19T09:05:46 CET" duration-ms="279" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- createContextAndPage -->
<test-method signature="testClinicalKpiAlphabeticalSorting()[pri:0, instance:platform.kpi.KpiTest@5b12012e]" started-at="2023-03-19T09:05:46 CET" name="testClinicalKpiAlphabeticalSorting" finished-at="2023-03-19T09:05:46 CET" duration-ms="77" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testClinicalKpiAlphabeticalSorting -->
<test-method is-config="true" signature="closeContext()[pri:0, instance:platform.kpi.KpiTest@5b12012e]" started-at="2023-03-19T09:05:46 CET" name="closeContext" finished-at="2023-03-19T09:05:46 CET" duration-ms="26" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- closeContext -->
<test-method is-config="true" signature="createContextAndPage()[pri:0, instance:platform.kpi.KpiTest@5b12012e]" started-at="2023-03-19T09:05:46 CET" name="createContextAndPage" finished-at="2023-03-19T09:05:46 CET" duration-ms="224" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- createContextAndPage -->
<test-method signature="testOperationalKpiAlphabeticalSorting()[pri:0, instance:platform.kpi.KpiTest@5b12012e]" started-at="2023-03-19T09:05:46 CET" name="testOperationalKpiAlphabeticalSorting" finished-at="2023-03-19T09:05:46 CET" duration-ms="3" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testOperationalKpiAlphabeticalSorting -->
<test-method is-config="true" signature="closeContext()[pri:0, instance:platform.kpi.KpiTest@5b12012e]" started-at="2023-03-19T09:05:46 CET" name="closeContext" finished-at="2023-03-19T09:05:46 CET" duration-ms="11" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- closeContext -->
<test-method is-config="true" signature="closeBrowser()[pri:0, instance:platform.kpi.KpiTest@5b12012e]" started-at="2023-03-19T09:05:47 CET" name="closeBrowser" finished-at="2023-03-19T09:05:47 CET" duration-ms="68" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- closeBrowser -->
</class> <!-- platform.kpi.KpiTest -->
</test> <!-- C:/CX/Candidates/CXP-Test-Automation/src/test/java/platform/kpi/KpiTest.java -->
</suite> <!-- All Test Suite -->
</testng-results> |
@mgesreha - I still DONOT understand what the issue is. The xml you shared vs the project you shared seem to be totally un-related. I only saw the below test methods in your project <?xml version="1.0" encoding="UTF-8"?>
<testng-results ignored="0" total="3" passed="3" failed="0" skipped="0">
<reporter-output>
</reporter-output>
<suite started-at="2023-03-19T18:53:33 IST" name="All Test Suite" finished-at="2023-03-19T18:53:33 IST" duration-ms="293">
<groups>
</groups>
<test started-at="2023-03-19T18:53:33 IST" name="C:/CX/Candidates/CXP-Test-Automation/src/test/java/platform/kpi/KpiTest.java" finished-at="2023-03-19T18:53:33 IST" duration-ms="293">
<class name="platform.kpi.mockTest">
<test-method signature="mocktest1()[pri:0, instance:platform.kpi.mockTest@226b143b]" started-at="2023-03-19T18:53:33 IST" name="mocktest1" finished-at="2023-03-19T18:53:33 IST" duration-ms="2" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- mocktest1 -->
</class> <!-- platform.kpi.mockTest -->
<class name="platform.kpi.KpiTest">
<test-method signature="testClinicalKpiAlphabeticalSorting()[pri:0, instance:platform.kpi.KpiTest@4af46df3]" started-at="2023-03-19T18:53:33 IST" name="testClinicalKpiAlphabeticalSorting" finished-at="2023-03-19T18:53:33 IST" duration-ms="66" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testClinicalKpiAlphabeticalSorting -->
<test-method signature="testOperationalKpiAlphabeticalSorting()[pri:0, instance:platform.kpi.KpiTest@4af46df3]" started-at="2023-03-19T18:53:33 IST" name="testOperationalKpiAlphabeticalSorting" finished-at="2023-03-19T18:53:33 IST" duration-ms="2" status="PASS">
<reporter-output>
</reporter-output>
</test-method> <!-- testOperationalKpiAlphabeticalSorting -->
</class> <!-- platform.kpi.KpiTest -->
</test> <!-- C:/CX/Candidates/CXP-Test-Automation/src/test/java/platform/kpi/KpiTest.java -->
</suite> <!-- All Test Suite -->
</testng-results>
Please clarify what am I missing here. |
@mgesreha - I am guessing that you are referring to this line <testng-results ignored="2" total="5" passed="3" failed="0" skipped="0"> and your concern is that I have only 3 It would have been really good if you had started off with this line, so that we could have gotten to the bottom of the confusion a lot more easier. Anyways moving on. Here's what is happening:
|
Closes testng-team#2886 TestNG by design excludes suite level configs When there is inheritance involved and multiple Children of the same base class are included in a suite. But when reporting the results as xml TestNG is not excluding these configs from the reports. Fixed this discrepancy.
@krmahadevan When do I expect this fix to be released? |
Well it should be soon. I am hoping to get around to a few more bug fixes before releasing.
Because your configuration methods includes playwright setup and I didnt want to have it done. So I disabled them. Which explains why it didn't show up first. |
Closes #2886 TestNG by design excludes suite level configs When there is inheritance involved and multiple Children of the same base class are included in a suite. But when reporting the results as xml TestNG is not excluding these configs from the reports. Fixed this discrepancy.
TestNG Version
7.7.1
Expected behavior
<testng-results ignored="2" total="5" passed="3" failed="0" skipped="0">
should contains only the results of @test annotated methods
Actual behavior
While I have only 3 test cases are all passed, and all configuration methods are passed also, I have 2 extra ignored with total 5 tests cases instead of 3 which is wrong
Is the issue reproducible on runner?
Test case sample
N/A
Contribution guidelines
Incase you plan to raise a pull request to fix this issue, please make sure you refer our Contributing section for detailed set of steps.
The text was updated successfully, but these errors were encountered: