I\'m using JUnit since I started this project and everything works just fine. I have a couple of hundreds tests, and of course, here and there I start them all. Right click on r
In my case I had to:
Resources Root
Just to add a different scenario, which happened to me and some of my coworkers:
Alt+enter in the class -> create test: IJ (2017.1.1) proposes Arquillian Junit as first option of testing library and by going with it the test class and methods are created without the 'public' identifier. Then if one decides to change the testing library to JUnit, it is easy to forget about the absence of the 'public' identifier, which causes the tests not to be recognised by IJ. Of course, the solution is to place the 'public' identifiers.
Although this is not what happened to you it has the same consequence, therefore this answer may help others experiencing the same symptoms.
I ended up manually categorising every sources root and test sources root in all the modules for the project. Worked like a charm.
For some reason Intellij Idea don't recognize classes as Test class that are not explicitly public, in case class has default access specificator it will not be marked as a test. Try to change class to meet this rule. Example:
public class TestMe {
@Test
public void shouldTest(){
Assert.assertEquals("test", "test");
}
}
On the latest IDE (as of Community Edition 2016.1) this option is more simplified.
right click on the folder you want to be recognized as a source folder:
Mark Directory As -> Sources Root
OK, I fixed it.
In menu, under File, there is an invalidate cache option. That fixed it!