"TestNG No tests found. Nothing was run" while executing automated tests using Selenium through TestNG

Jimin Park picture Jimin Park · Jun 26, 2019 · Viewed 11.3k times · Source

image

I want to know what exact software should I install before I run my automation project. Selenium web driver, selenium java, testNG, junit was installed but there are some problems with that also. 1. Selenium java file doesn't have more JAR files like people shows in their video tutorials. 2. When I' going to run my project as testNG, eclipse said windows firewall has blocked some features of this app.

Answer

DebanjanB picture DebanjanB · Jun 26, 2019

This error message...

[TestNG] No tests found. Nothing was run

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

Your main issue is though you have imported Test as:

import org.testng.annotations.Test;

But your code block has no @Test as such but includes a @BeforeClass. As there are no tests, TestNG doesn't find any Test to execute.


Solution

The easiest solution would be to change the @BeforeTest annotation with @Test and execute you Test case / Test Suite.