0
votes

I'm using Selenium to automate some web browser tests, alongside Gradle for build setup and TestNG as the test framework. I have the following TestNG testng.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Test Suite">
<test name="Firefox">
   <parameter name="browser" value="Firefox"/>
   <classes...>
</test>
<test name="IE">
   <parameter name="browser" value="IE"/>
   <classes...>
</test>
<test name="Chrome">
   <parameter name="browser" value="Chrome"/>
   <classes...>
</test>

...where I'm running the same test methods within for IE, Chrome and Mozilla Firefox.

The output for my Gradle files looks like follows:

enter image description here

enter image description here

The above represents a report generated to relative directory build/reports/tests/index.html which contains all of the test cases for all three tests.

What I want instead is to have one report file generated for each test, as opposed to one report file being generated to contain all tests. E.g. I would have Firefox tests in build/reports/tests/firefox.html, IE tests in build/reports/tests/IE.html, and Chrome tests in build/reports/tests/chrome.html.

How would I go about doing this?

Thanks.

1

1 Answers

1
votes

TestNG generates reports per suite (as I know). You can get several reports by running suite of suites. For this you need to move each test tag to new xml file, and then add them to one suite or run one by one. Also you could specify TestNG suites directly in gradle task.