![](/img/trans.png)
[英]“No tests found. Nothing was run” error in selenium automation using TestNG
[英]RestAssured - TestNG "No tests found. Nothing was run"
我想用 TestNG 测试我的 api 对 RestAssured 的使用,但我得到了一些错误。“没有测试是 [TestNG] 没有找到测试。没有运行”。 所以这是我的 pom.xml 文件和 testng.xml 文件。
Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>LifeboxAutomation</groupId>
<artifactId>LifeboxAutomation</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</project>
testng.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite">
<test verbose="2" name="C:/Users/EXT02D49935/IdeaProjects/LifeboxAutomation">
<classes>
<class name="PreReq.payload">
<methods>
<include name="userAuth"/>
</methods>
</class>
<class name="Album">
</class>
</classes>
</test>
</suite>
感谢您的时间
好的,我删除了 psvm 的 @test。 我刚刚添加了@test 我的另一个类,如下所示:
package PreReq;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;
public class payload {
@Test
public static String userAuth(){
并像这样重命名 testng 配置名称:
但我仍然有错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.