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:
< suite name = "Suite1" verbose = "1" > |
< class name = "NoPackageTest" /> |
< class name = "test.sample.ParameterSample" /> |
< class name = "test.sample.ParameterTest" /> |
收藏
举报
TAG: