Basically, you only need junit.jar on the classpath - and here's a quick way to do it:
Make sure you have a source folder (e.g. test
) marked as a Test Root.
Create a test, for example like this:
public class MyClassTest {
@Test
public void testSomething() {
}
}
Since you haven't configured junit.jar (yet), the @Test
annotation will be marked as an error (red), hit f2 to navigate to it.
Hit alt-enter and choose Add junit.jar to the classpath
There, you're done! Right-click on your test and choose Run 'MyClassTest' to run it and see the test results.
Maven Note: Altervatively, if you're using maven, at step 4 you can instead choose the option Add Maven Dependency..., go to the Search for artifact pane, type junit
and take whichever version (e.g. 4.8 or 4.9).