1. 참조 TestNG를 패키지 버전 선택
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.21</version>
</dependency>
2. 쓰기 testNG.xml 파일
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="suiteOne" parallel="true" thread-count="2">
<test name="testCase1">
<groups>
<run>
<include name="testGroups"/>
<include name="testGroups2"/>
</run>
</groups>
<classes>
<class name="com.xinzf.CalculateMethodTest"/>
</classes>
</test>
</suite>
3. 구성 받는다는
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<!--<testFailureIgnore>true</testFailureIgnore>-->
<forkMode>never</forkMode>
<argLine>-Dfile.encoding=UTF-8</argLine>
<suiteXmlFiles>
<!--testng.xml文件位置-->
<suiteXmlFile>src/main/resources/testNG.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
테스트 클래스를 작성하십시오
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
* @Author: xinzhifu
* @Description:
*/
public class CalculateMethodTest {
@Test
public void testParam() {
Assert.assertEquals("1","2");
}
}
5. 구성 아이디어
"실행 ---> EditConfgiuration"
프로젝트 디렉토리에 생성 된 테스트 케이스 실행 테스트 아웃 테스트 보고서를 표시합니다 index.html을, 파일을
TestNG의 학습 자료 https://www.jianshu.com/p/0d50965b938d