When i\'m trying to run the test suite, am getting this exception. We are using maven project here and i am done with refreshing, cleaning, reinstalling testNG and then impo
I also had this issue.
I'm using IntelliJ IDEA.
I was using src/main/java
for configuration files and src/test/java
for test files.
Because of this testNG couldn't find the class path.
To prevent getting that error need to move all the files from src/main/java
to src/test/java
or vice versa.
I faced the similar issue on importing maven with testng project. This was solved by converting again into TestNg project by
right click on eclipse project > TestNG > Convert to TestNG
and replacing the existing testng.xml
file with the newly created. Clean and update the maven project with mvn install
Note: take backup of your testng.xml
Let me share what worked for me:
When we do "mvn clean" - we are cleaning old compiled classes please lgo to ocation "your project directroy -> target " you will find this folder is getting cleaned because that's where MVN places it's compiled artifacts
Since it's already a MAVEN project then go to your project folder and open in command prompt. And issue "mvn clean" and then "mvn test" -> "mvn test" command will place all the compiled files under proper folders and then you can run your tests through TestNG or MAVEN itself.
Make sure you set up "M2_HOME" or "MAVEN_HOME" to your env path , sometime "MAVEN_HOME" doesn't work so add "M2_HOME" as well (google it for this set up)
Above suggestions worked for me so I wanted to share, good luck
I had the same error when tried to run my tests in a JSF project.
I´m using Eclipse IDE (kepler). So, I did "project > clean" and then ran the tests again of the same project.
It worked!
include the package name with class. It will remove your name. I also got the same issue but adding the package name with class fixed this issue.
After done trying everything that I found on this issue, in eclipse,
I selected my project --> right click --> Run as --> Maven generate-sources
Then I re-ran my TestNG project and it ran perfectly fine without any issues.Hope that helps :)