Read for TestNG

上一篇 / 下一篇  2012-04-25 15:34:24 / 个人分类:TestNG/Ant/Eclipse/Java

Writing a test is typically a three-step process:

  • Write the business logic of your test and insertTestNG annotationsin your code.
  • Add the information about your test (e.g. the class name, the groups you wish to run, etc...) in atestng.xmlfile or in build.xml.
  • Run TestNG.

The concepts used in this documentation are as follows:

  • A suite is represented by one XML file. It can contain one or more tests and is defined by the<suite>tag.
  • A test is represented by<test>and can contain one or more TestNG classes.
  • A TestNG class is a Java class that contains at least one TestNG annotation. It is represented by the<class>tag and can contain one or more test methods.
  • A test method is a Java method annotated by@Testin your source.

<suite>

<test>

<classes>

<class>

<methods>

(annotated by@Testin your source)

<include name="method1">

<include name="method2">

<exclude name="method3">

</methods>

<methods>

</methods>

<class>

</classes>

<classes>

***********

</classes>

</test>

<test>

******

</test>

</suite>

Here is an exampletestng.xmlfile:
 
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
 
<suitename="Suite1"verbose="1">
<testname="Nopackage">
<classes>
<classname="NoPackageTest"/>
</classes>
</test>
<testname="Regression1">
<classes>
<classname="test.sample.ParameterSample"/>
<classname="test.sample.ParameterTest"/>
</classes>
</test>
</suite>

TAG:

 

评分:0

我来说两句

日历

« 2024-05-10  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 74567
  • 日志数: 80
  • 建立时间: 2012-04-12
  • 更新时间: 2013-05-21

RSS订阅

Open Toolbar