Sumod
Sumod

Reputation: 3846

TestNG - how to change the DefaultSuite and DefaultTest to your choice of name in the results file

I am running TestNG with Selenium 2.0 and Eclipse. My results get generated in the /test-output folder. The index.html and emailable-report.html files show the test name as default test and suite name as default suite. I would like to customize it and use the names of my choice. How do I do that?

So far I have tried following approaches. 1. In the run configurations, add the arguments testname and suitename - not work 2. Use testng.xml file to run the tests instead of class name - not work. It has its own issues and I will post a separate question :)

Thanks

Upvotes: 5

Views: 7126

Answers (3)

Silverbullet
Silverbullet

Reputation: 154

Use default testng.xml or make duplicate of this in a different name e.g. smoketest.xml and customise, add required test path using tag.Right click and run as testNG test suite. See example code for xml.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Smoke Test Suite" preserve-order="true" parallel="tests" thread-count="1">
 
	<test name="SMOKETEST">
     <classes>	
          <class name="com.automation.mycompany.project.packagename.classname"/>			
     </classes>
  	</test>

Upvotes: 1

Praveen
Praveen

Reputation: 201

You can customize the suite name and test case name under execution as following.

To customize the Suite name, Add the attribute name to the suite tag in testing.xml

   Eg: <suite name="MySuiteName">

To customize the Test Case name,Add the attribute name to the test tag in testing.xml

   Eg:  <test name="MyTestName">

Upvotes: 2

Alexei Barantsev
Alexei Barantsev

Reputation: 534

Use template XML file: http://testng.org/doc/eclipse.html#eclipse-listeners

Upvotes: 3

Related Questions