0

Currently we use testng ITestContext to get the test count running via testng xml file. My file contains multiple classes and

context.getPassedTests().size()

returns the total count of passed tests from all the classes mentioned in the xml file my file looks like this :

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >

<suite name="Main service" verbose="1" >
    <test name="Smoke and Sanity" >
        <classes>
            <class name="tests.Service1" />
            <class name="tests.Service2" />
            <class name="tests.Service3" />
        </classes>
    </test>
    <listeners>
        <listener class-name="com.service.data.Base.TestResult"></listener>
    </listeners>
</suite>

TestResult implements ITestListener and calculates the total number of tests being run by summing up context.getPassedTests().size() + context.getFailedTests().size() + context.getSkippedTests().size(), and this returns the total number of tests from classes service1, service2, service3

What i want is to get the total number of test cases from individual test class mentioned in xml and not the combined.

unable to find an approach

0 Answers0