I need an absolute beginners guide to using JUnit and Intellij IDEA 9.x together. I’m running JDK 1.6.0_22 on WinXP. I’m looking for answers to the following questions:
- Do I need to install JUnit or is it already integrated into Intellij? If I need to set it up how?
- Assuming I have the interface and impl for a class I want to test, how do I set up a JUnit project?
- Is there a way to autogen a test skeleton based on the class interface?
I’ve got experience with other Unit testing frameworks like, PHPUnit and Boost.Test, so I’m primarily concerned with the mechanics of getting all this set up and running in Intellij.
Edit
I’m a complete newb using Intellij.
I’m coming from a command-line background, i.e. C++ dev using vim and handwritten make files on Linux.
I’ve managed to compile and run some JUnit tests via command line ( downloaded JUnit 4.8.2 and used the -cp swith), but I’m having a heck of a time getting anything set up under Intellij. I tried looking at the online Intellij docs, but haven’t found those to be very useful. I looked in Intellij’s lib directory and it includes Junit-4.7.jar.
I really need some kind of quick start guide with step by step instructions from initial project creation through successfully running the first unit test.
lib/).@org.junit.Test, as per this quick tutorial, IDEA does not require anything further. For any class with this annotation on at least one of its methods, IDEA will give you the option to execute that class as a JUnit test case. (Note: this may only be the case for files in a directory that’s marked as “Test Sources” in the project structure, but I haven’t tested this. It’s a good idea to set your project up like this anyway.)