开发者

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

开发者 https://www.devze.com 2023-02-23 06:12 出处:网络
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

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 configurat开发者_如何学JAVAions, 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


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


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">


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>

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号