Error: org.testng.TestNGException: Cannot find class in classpath: EmpClass

前端 未结 30 1290
礼貌的吻别
礼貌的吻别 2020-12-09 08:17

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

30条回答
  •  清歌不尽
    2020-12-09 08:58

    I also ran into the same problem with TestNG version 6.14.2

    However, this was due to a foolish mistake on my end and there is no issue whatsoever with maven, testng or eclipse. What I was doing was -

    1. Run project as "mvn clean"
    2. Select "testng.xml" file and right click on it to run as TestNG suite
    3. This was giving me the same error as reported in the original question
    4. I soon realized that I have not compiled the project and the required class files have not been generated that the TestNG would utilize subsequently
    5. The "target" folder will be generated only after the project is compiled (Run as "mvn build")
    6. If your project is compiled, this issue should not be there.

提交回复
热议问题