Extent Report no generating for multiple suites - selenium

I am trying to execute a suite of suite xml file .But extent report is generating only for first suite
<suite name="allSuites">
<suite-files>
<suite-file path="suite1.xml" />
<suite-file path="suite2.xml" />
<suite-file path="suite3.xml" />
<suite-file path="suite4.xml" />
</suite-files>
</suite>

Ideally if you have put the initialisation of the report in #BeforeSuite and flush() call in the #AfterSuite , then individual reports will be generated for all the suites.
Incase you followed the same and still its not as expected then please share more details.

Related

Is it possible to have mutiple test suites in TestNG?

I know that we can have multiple tests in a single suite. But if I want to run more than one suite in a go, is there any way?. There were couple of questions already asked but the solution given doesn't seem to be clear.
You can create an XML file for each suite and after that, you can add them in testng.xml file like this
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="TestNG All Suites" >
<!-- suite name="Suite Name" -->
<suite-files>
<suite-file path="./firstSuite.xml" />
<suite-file path="./secondSuite.xml" />
<suite-file path="./thirdSuite.xml" />
</suite-files>
</suite>
./ - means that the file is located in the same directory as the testng.xml file

Test suite result dependency in testNG

I have test suite xml file that contains other test suites in the following format:
<suite-files>
<suite-file path="debug1.xml" />
<suite-file path="debug2.xml"/>
</suite-files>
Is there a way to add a dependency between the two sub suites? Meaning if debug1.xml fails, then debug2.xml should not be executed at all.
TestNG does not provide any dependency on the <suite-files> level. Can this be done, perhaps, through some listener?
You can define TestNG groups in your test code and arrange the dependencieslike:
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="test">
<groups>
<dependencies>
<group name="debug1" depends-on=""/>
<group name="debug2" depends-on="debug1"/>
</dependencies>
</groups>
<suite-files>
<suite-file path="debug1.xml"/>
<suite-file path="debug2.xml"/>
</suite-files>
</suite>
References:
TestNG XML
TestNG

Can you run a suite of suites but exclude certain tests from running?

Is there any way to specify I would like to run a suite of suites but on a particular suite exclude specified tests?
<suite name="allSuites">
<suite-files>
<suite-file path="suite1.xml" />
<suite-file path="suite2.xml" /> <!-- exclude TestX and TestY -->
</suite-files>
</suite>

Not getting report of TestNG in ReportNG

I am executing testng in eclipse and I want generate the report in reportNG. For that I have inlcuded guice-3.0,reportng-1.1.3,velocity-dep-1.4 jar files and added listeners in xml file Also I have disable the default TestNG listener in eclipse.
After all that I am not getting the report in ReportNG. What else I have to do?
This is the xml code....
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Registration" verbose="1" preserve-order="true">
<parameter name="Suitename" value="Registration" />
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter" />
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>
<test name="Search">
<classes>
<class name="com.tcs.medmantra.reg.Search"/>
</classes>
</test>
</suite>
Thanks in advance.....
You have to first run the tests by running the testng.xml as TestNG suite.
Then after that refresh the project.
Now goto the test-output folder -->html-->index.html (Open with Web Browser).

unable to run selenium2 suite in testNG

I am not able to run test suite in eclipse with testNG for selenium2.
TestNG appears to run, but the Total tests run is always 0.
I am able to run this test from eclipse directly with selenium2 (run as->java application).
I am able to test the testNG for a small program with #Test, #BeforeMethod,#AfterMethod annotations
kindly help me
xml file contents
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="WikiPedia test" verbose="3" parallel="methods" >
<test name="wiki">
<classes>
<class name="com.programs.WebDriverTest" />
</classes>
</test>
</suite>
You need to Run As...TestNG Test, not as Java application.