I\'m trying to run a testing suite using XML and TestNG, but I\'m always getting the same message using both: Eclipse and the command line:
[TestNG] Running:
/
This can also happen when there is groups usage in suite.xml and @BeforeXXX annotations have missing alwaysRun = true.
@BeforeTest(alwaysRun = true)
public void setUp() throws IOException {
}
I had the same problem and here is my results: In my project I had test file in
src/test/java/com/temporary/core
and in the same time I had resources for the test in
src/test/resources/com/temporary/Core
As I found, testng tried to find test file in the second directory.
When I renamed directory with resources from Core to tcore, the problem was fixed.
You could also check imports for imported Test annotation, should be:
import org.testng.annotations.Test;
@Test
public myTest(){ ... }
and not for example:
import org.junit.Test;
I had done all possible solution that everyone shared here and still does not work.
Heard someone mentioned creating a new workspace.
So I started a new workspace and recreated the whole TestNG suite & methods.
It worked!
Most probably my other TestNg stuff in my previous workspace could have conflicted with the recent Testng setup.
So starting a new workspace solved!
if the @Test method is public boolean() with return type as true/flase it doesnot execute.. strange but worked in my-case.
I had to change my method access modifier to public from private to get it working .