Instructor
Ashish Thakur Replied on 28/02/2020
Please share the exception stack trace.
We need to analyse the log before we can suggest a solution.
There is no exception after running testng.xml file.I have attached screeshot of "Result of running Suite" tab where last method name is not showing in the list and sometimes all the method names of the last class file does not show in result tab but the output in console tab is showing correct(i.e., method count or total test run is 12). If you verify the result tab in screenshot method count is 11, sometimes it also shows 9. Here, the method count is not matching with the output in console(or per my class files).
Below is the output in console:-
[RemoteTestNG] detected TestNG version 6.14.3
===============================================
Suite A
Total tests run: 6, Failures: 2, Skips: 1
===============================================
===============================================
Suite B
Total tests run: 6, Failures: 2, Skips: 0
===============================================
===============================================
My Suite
Total tests run: 12, Failures: 4, Skips: 1
===============================================
Below is the code in my suite files:-
Suite_A.xml -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite A">
<test name="Test A1">
<classes>
<class name="testSuiteA.TestA1"/>
</classes>
</test>
<test name="Test A2">
<classes>
<class name="testSuiteA.TestA2"/>
</classes>
</test>
</suite>
Suite_B.xml -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite B">
<test name="Test B1">
<classes>
<class name="testSuiteB.TestB1"/>
</classes>
</test>
<test name="Test B2">
<classes>
<class name="testSuiteB.TestB2"/>
</classes>
</test>
</suite>
Master testng.xml -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="My Suite">
<suite-files>
<suite-file path="./Suite_A.xml"></suite-file>
<suite-file path="./Suite_B.xml"></suite-file>
</suite-files>
</suite>
TestB2 class file code:-
package testSuiteB;
import org.testng.Assert;
import org.testng.annotations.Test;
public class TestB2 {
@Test
public void testB2_1(){
}
@Test
public void testB2_2(){
Assert.fail("Failed the testcase");
}
@Test
public void testB2_3(){
}
}
Please let me know, If you need anymore information. I am not getting option to attach more than one file here(i.e., suite_A, suite_B & testng.xml files etc). So, I pasted the code here so that you can have a look)
Please suggest how to proceed further.
Instructor
Ashish Thakur Replied on 03/03/2020
Please export your project in a compressed zip file and share it with us.
Please find the project in the attachment.
It provides inconsistent result when running multiple times. Sometimes it shows the method count correctly sometimes not.
And I am using eclipse Luna.
Instructor
Ashish Thakur Replied on 04/03/2020
The code is executing fine over here.
You can ignore the output in the plugin. Instead you can rely on the console output. This is always a stable output.
Ok. Thank you for the information.