JUnit Eclipse Plugin? [closed]

2020-02-23 05:03发布

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?

8条回答
SAY GOODBYE
2楼-- · 2020-02-23 05:16

You do not need to install or update any software for the JUnit. it is the part of Java Development tools and comes with almost most of the latest versions in Eclipse.

Go to your project. Right click onto that->Select buildpath->add library->select JUnit from the list ->select the version you want to work with-> done

build you project again to see the errors gone:)

查看更多
成全新的幸福
3楼-- · 2020-02-23 05:18

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.

查看更多
你好瞎i
4楼-- · 2020-02-23 05:20

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").

查看更多
狗以群分
5楼-- · 2020-02-23 05:20

You might want to try out Quick JUnit: https://marketplace.eclipse.org/content/quick-junit

The plugin is stable and it allows switching between production and test code. I am currently using Eclipse Mars 4.5 and the plugin is supported for this release as well as for the following:

Luna (4.4), Kepler (4.3), Juno (4.2, 3.8), Previous to Juno (<=4.1)

查看更多
我只想做你的唯一
6楼-- · 2020-02-23 05:23

JUnit is part of Eclipse Java Development Tools (JDT). So, either install the 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).

You add it to a project by right clicking the project in the Package Explorer and selecting Build Path -> Add Libraries... Then simply select JUnit and click Next >.

查看更多
相关推荐>>
7楼-- · 2020-02-23 05:31

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.

查看更多
登录 后发表回答