【发布时间】:2017-03-22 03:27:09
【问题描述】:
代码在 TESTNG 中分组
package testNG_annot;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestNG_grp1
{
@BeforeMethod
public void CarBM() {
System.out.println("CarBM");
}
*** // Created group car and Two wheeler//***
@Test(groups = { "Car" })
public void Sedan1() {
System.out.println("Test1-Verna");
}
@Test(groups = { "Car" })
public void Sedan2() {
System.out.println("Test2-BMW");
}
@Test(groups = { "TwoWheeler" })
public void Scooter1() {
System.out.println("Test3-ScootyPep");
}
@Test(groups = { "TwoWheeler" })
public void aScooter2() {
System.out.println("Test4-TVS");
}
}
套件.xml
<?xml version="1.0" encoding="UTF-8"?>
<suite name="grp11">
<test name="group1">
<gropus>
<run>
<include name="Car"/>
</run>
</gropus>
<classes>
<class name="testNG_annot.TestNG_grp1"/>
</classes>
</test>
</suite>
【问题讨论】:
-
-
更改组的拼写。这可能是您出错的原因。
-
参考这个问题,它将解决您的问题。 stackoverflow.com/questions/41844611/…
标签: selenium automation testng