Skip to content
Advertisement

RestAssured – TestNG “No tests found. Nothing was run”

I want to test my api’s use RestAssured with TestNG but i got some error’s.”No tests were [TestNG] No tests found. Nothing was run”. So here is my pom.xml file and testng.xml file.

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>

testNG Configuration

Part of my main class

Thank you for your time

Advertisement

Answer

Ok i remove the psvm and i just use public void instead of psvm. So @test si working

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement