views:

471

answers:

6

I feel stupid for not being able to find this, but where is the JUnit plugin for Eclipse? I've included the latest .jar in my buildpath, but I still don't have the option to create a new test case, run test cases with the green/red bar, etc. I need the plugin for this, right?

EDIT: I'm using "Eclipse for PHP Developers". So perhaps that wouldn't include JUnit automatically. Do I have to download Eclipse again, or can I just get that functionality somehow?

+1  A: 

Junit is included by default with Eclipse (at least the Java EE version I'm sure). You may just need to add the view to your perspective.

aubreyrhodes
Just a note, J2EE is renamed Java EE since a year or three.
BalusC
Good point, Thanks.
aubreyrhodes
+2  A: 

It's built in Eclipse since ages. Which Eclipse version are you using? How were you trying to create a new JUnit test case? It should be File > New > Other > Java - JUnit - JUnit Test Case (you can eventually enter Filter text "junit").

BalusC
actually, I'm using PHP Eclipse (see above). Can this be fixed, or do I need to download again?
Rosarch
I am not sure about that, sorry. But if you can't find it anywhere in the list, then I recommend to go get "Eclipse for Java developers" (or "Eclipse for Java EE developers" if you like to play with Java/JSP/Servlet webapps as well) and then add the PHP plugin afterwards.
BalusC
I can't find the Junit package fore eclipse after googleing around a bit, so I think your best bet would just be to download a java version of eclipse.
aubreyrhodes
@aubreyrhodes FYI, it's included in the JDT.
Pascal Thivent
A: 

Eclipse has built in JUnit functionality. Open your Run Configuration manager to create a test to run. You can also create JUnit Test Cases/Suites from New->Other.

sticksnleaves
+2  A: 

You should be able to add the Java Development Tools by selecting 'Help' -> 'Install New Software', there you select the 'Galileo' update site, then 'Programming Languages' -> 'Eclipse Java Development Tools'.

After that, you will be able to run your JUnit tests with 'Right Click' -> 'Run as' -> 'JUnit test'.

Fabian Steeg
+1  A: 

JUnit is part of Eclipse Java Development Tools (JDT). So, either install thee JDT via Software Updates or download and install Eclipse IDE for Java Developers (actually, I'd recommend installing Eclipse IDE for Java EE Developers if you want a complete built-in environment for server side development).

Pascal Thivent
A: 

Maybe you're in the wrong perspective?

Eclipse has a construct called a "perspective"; it's a task-oriented arrangement of windows, toolbar buttons, and menus. There's a Java perspective, a Debug perspective, there's probably a PHP perspective, etc. If you're not in the Java perspective, you won't see some of the buttons you expect (like New Class).

To switch perspectives, see the long-ish buttons on the right side of the toolbar, or use the Window menu.

Ladlestein