Error: TestNG ERROR Cannot find class in classpath
- Go to Eclipse> Project > Clean and then run the test cases again. It should work.
- And update the maven project (Project > Maven > Update Maven Project)
What it does in background is, that it will call mvn eclipse:clean in your project directory which will delete your .project and .classpath files and you can also do a mvn eclipse:eclipse – this regenerates your .project and .classpath files. Thus adding the desired class in the classpath.
Related Link: https://stackoverflow.com/questions/7600898/testng-error-cannot-find-class-in-classpath
Error: java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/google/inject/Stage error when using TestNG through eclipse [closed]
if you use TestNG version 7.0.0 or upper you may get this error. To solve the issue we need to import jar file or related dependency in your POM file as below:
Jar Link: https://mvnrepository.com/artifact/com.google.inject/guice/4.2.2
Related Link : https://github.com/cbeust/testng/pull/2264