UTF-8 io.rest-assured rest-assured 4.1.2 test org.testng testng 6.14.3 ************************************************** TestNg.xml

enter image description here

  • Show us your pom.xml
    – Alexey R.
    Aug 23 '20 at 19:11
  • <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <version>4.1.2</version> <scope>test</scope> </dependency> <!-- mvnrepository.com/artifact/org.testng/testng --> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.14.3</version> </dependency> <dependency> <groupId>com.github.scribejava</groupId> <artifactId>scribejava-apis</artifactId> <version>2.5.3</version> <scope>test</scope> </dependency> Aug 23 '20 at 19:18
  • <version>6.14.3</version> TestNg Version Aug 23 '20 at 19:19
  • Just put your pom to your question. not to comments. Including plugins section.
    – Alexey R.
    Aug 23 '20 at 19:19
  • Added my POM in ques Aug 23 '20 at 19:21

make sure you are importing org.testng.annotations.Test and not org.junit.Test


This error message implies that TestNG didn't find any @Test to execute.

[TestNG] No tests found. Nothing was run

Make sure you have imported Test annotation & used @Test to execute.

import org.testng.annotations.Test;
  • I have imported the correct dependecy import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; import org.testng.annotations.Test; import io.restassured.RestAssured; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; Aug 24 '20 at 4:54
  • Are you using the @Test annotation in the script to execute test? Aug 24 '20 at 5:31
  • Yes, @Test public void getAPITest() { Aug 24 '20 at 5:40
  • Share the code snippet .... are you using annotation in the main method? Aug 24 '20 at 6:08
  • because the main method does not take any annotation. If you provide any TestNG annotation to the main method then you will get the same error. Aug 24 '20 at 6:10

As per your code reference testng.xml and your test class there is no method getTestNgTest1 inside the class com.rest.api.authentications.OAuth2APITest

Change the testng.xml to the below one probably it will work

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
    <suite guice-stage="DEVELOPMENT" name="Default suite">
      <test thread-count="5" verbose="2" name="Default test">
          <class name="com.rest.api.authentications.OAuth2APITest" />
      </test> <!-- Default test -->
    </suite> <!-- Default suite -->
  • Updated TestNg.xml but no Luck Still same issue . Aug 24 '20 at 7:00
  • @AshutoshSingh I made a run from my local machine with your sample code and my updated testng.xml works fine for me. Try by adding scope to your testng dependency in pom.xml file and atlast make restart to your IDE. Make cross verify whether the dependencies are loaded to your project from POM file not from the Jar file in buildpath which you may have added unknowingly Aug 24 '20 at 7:36
  • I have added and follow the instruction but still not working pom.xml link gist.github.com/asingh4305/4870d1cd56b6112495255934306000cd Aug 24 '20 at 8:12

Your pom.xml has to include maven surefire plugin inside <build>...</build> tags:


Then you can execute your tests by running mvn test.
Bare in mind it will pick up every class that has a ...test suffix and look for methods annotated with @Test only in such classes.

How to execute a single test (question in comments):
You can provide method name in testng.xml file, like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="testSuite" verbose="1">
    <test name="tests">
            <class name="className">
                    <include name="testMethodName"></include>

Or simply run it via maven:

mvn test -Dtest=className#methodName

When executing a single test via maven, you might need to add -DfailIfNoTests=false so that maven does not fail, when multiple modules exist.

  • Correct i want to run only single test at a time... Not entire build Aug 26 '20 at 7:29
  • I have updated my answer with information on running a single test.
    – Moro
    Aug 26 '20 at 8:03
  • mvn test -Dtest=className#methodName Its worked ..thanks Aug 26 '20 at 12:11
  • If my answer helped you, please mark it as solved, so that others can use it as reference.
    – Moro
    Aug 27 '20 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.