NoClassDefFoundError: org/testng/TestNG

adding a screenshot to aid Justin's answer above. The default is In single module which needs to be changed to In whole project.


I found a solution posted here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206597869-Cannot-launch-NGTest-runner-in-IntelliJ-IDEA-2016-1

I got it to work by selecting "In whole project" (I had "In single module" selected) under the Configuration tab in the TestNG "Run/Debug Configurations."

However, the prior configuration worked in IntelliJ IDEA 15, so to me, it seems that it may have come from a breaking change with newer IDE.

It worked for me.

Tags:

Java

Ide

Testng