TestNG基础教程

TestNG 是自动化测试框架,比Junit更强大,可用于单元测试,功能测试,端到端测试等,下面我们就介绍一下如何基于IntelliJ IDEA 创建TestNG test?

打开IntelliJ IDEA -> Create New Project -> Next ->  Next -> 编写项目名称 -> Finished

打开https://mvnrepository.com/artifact/org.testng/testng/7.0.0 下载testng-7.0.0.jar 文件

File -> Project Structure... -> Modules -> Dependencies -> Add JARs or directories 添加testng-7.0.0.jar -> Apply -> OK

创建测试用例

Add Configuration... -> Add New Configuration -> TestNG

自定义名称 TestNG -> 选择测试类 如TC1 -> OK 

Listeners -> Use default reporters -> Apply -> OK

运行TestNG

运行效果

原文地址:https://www.cnblogs.com/54tester/p/11516004.html