0 test class found in package ‘

2020-05-29 16:04发布

问题:

I have recently installed IntelliJ IDEA 13.1.4 and the jRebel plugin. I have licensed it ok and created and added configurations in catalina.bat file.

When running jRebel from within IntelliJ, it seems to be monitoring the correct directories but I get the following message:

0 test class found in package ‘’

This then tells me that it has failed to start.

Does anybody know what I might need to change to get this to work?

回答1:

This can be fixed by invalidating the cache.

On the main menu, choose File -> Invalidate Caches/Restart.

Source



回答2:

Make sure your class is declared as public and not 'default'

public class MyClassTest

as opposed to:

class MyClassTest

When creating a new test class via IntelliJ shortcut the generated class was not declared as public and that caused the error.



回答3:

Make sure 'app' is selected to run...



回答4:

When I used the IntelliJ 'Create Test' feature, my test classes were automatically created as private.

When I manually changed my test classes to public, my test classes were found.

Source



回答5:

On your topbar or Alt + Shift + F10 and Run your project with your default Configuration not "values in app"



回答6:

Just create another folder, which will mark the directory as Sources Root and move your executable file into this folder.



回答7:

What worked for me was deleting the .idea folder and importing the project again.



回答8:

For me this was the problem: My test folder was ./test/src/com/.... I had marked test as test folder, but test/src was the right one.

The "false" setting worked for me with Jintellij 2017.1.3, but not in 2018.02.



回答9:

I had this same issue and for me it was because TestNG plugin was not installed in Intellij. I did not choose it when installed Intellij and forgot about that.