How to integrate Junit plugin into my custom plug in? [duplicate] - plugins

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Call JUnit from other Eclipse Plugin
In my Eclipse custom plugin, I can do the unit test with junit. I want to show the results on Junit plugin's view. How to call code in Junit plugin in my custom plugin? Thanks.

Either create a TestSuite and fake out the tests to generate your desired output or try to reuse the console part of the junit plugin.
otherwise your only other choice is to patch the junit plugin which is not recommended because you can screw up the plugin and it is difficult to garauntee will run the same on all versions of eclipse.

Related

Eclipse cannot run JUnit 5 test cases in JUnit suite?

I've got working junit test cases I'd like to run in an Eclipse test suite. However, Eclipse only seems to have test suite support for JUnit 4 and 3.
It seems my options are to either either downgrade my test cases (which I'm unsure how to do) or upgrade the test suites as well (which I can't seem to find an option for).
Any help?
EDIT: For clarity, I'm working on the latest Eclipse Photon version, just downloaded it two days ago.
With a plain Photon (Java Developers flavour) install, follow these steps to get a working simple eclipse project with a JUnit5 test and a suite containing this test.
On project creation or in the project properties, add JUnit5 as library
Add your tests, run them
Add a test suite (the new Test Suite wizard is lacking the option to create a JUnit5 Suite, you'd need to write it by hand - was that what you were asking?)
In package explorer, do right click on a project and,
Click 'Build Path'
Click 'Add Libraries'
Click on 'JUnit 5' in the list and next, finish.
Then run the tests again.

Is it possible to write an IntelliJ plugin using Scala? [duplicate]

This question already has an answer here:
IntelliJ IDEA plugin development in other JVM languages
(1 answer)
Closed 9 years ago.
Pretty straightforward: I'm allergic to Java but want to write a plugin for IntelliJ. Is this possible?
It wants me to set up a project SDK, but it only allows for Java SDKs, not Scala. Since they both run in JVM, I don't see why using Scala would be a problem.
Scala plugin for IntelliJ IDEA has 85% Scala code, so yes it's possible. You can take a look for our configuration: https://github.com/JetBrains/intellij-scala
Together with setup description you will be able to setup plugin development for your plugin: http://confluence.jetbrains.com/display/SCA/Setting+up+Scala+plugin+project+in+IntelliJ+IDEA

JUnit test outside eclipse [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
JUnit test equivalent in CLI
I have created a java project in eclipse. I am able to right click and export the project to and executable jar file so it can be run from the command line using the JRE tools.
For this same project I also have Junit tests. Specifically I am using JUnit version 4. How can I run the JUnit tests from the command line like I can in eclipse (Right Click Project-->Run As-->JUnit Test)
It is best to use some project management tool such as Maven or Ant (for small projects). This way you'd get IDE independent project with capability to build and run tests outside of the IDE of your choice.

JUnit plugin integration

Is there a way to integrate in an Eclipse RCP project the JUnit Window? I am planning on creating a test script runner and I want JUnit window to be in my application.
Sure, but not as you expect it. The JUnit view is contributed by org.eclipse.jdt.junit (which you can see by hitting Shift-Alt-F1 with that view being active). So you need to include that as a dependency in your plugin (or in your product definition, if you have one).
The bad news: I have not checked the dependencies for that plugin, and those dependencies will probably take most of the JDT into your application also, which is probably not desired.

Why is Eclipse using JUnit 3 when I have junit-4.3.1.jar in my build path?

I'm using Ganymede on Ubuntu Linux and I have junit-4.3.1.jar in my build path. I click File > New > Java > "JUnit 4 Test Case" when I create a new test, but when it's run, Eclipse appears to be using JUnit 3. I believe this is the case because it's ignoring my annotations.
When I remove all test* methods, JUnit complains "No tests found". If I do the same with another test I already created, JUnit runs fine and finds my test named createTask(). So, it appears to be using JUnit 3 at times, and JUnit 4 at others.
How do I force Eclipse Ganymede to use JUnit 4?
I figured out the answer via this link:
Spring is apparently incompatible with JUnit 4.3.1 when extending AbstractTransactionalSpringDataSourceTest (or whatever it is). So, I upgraded to JUnit 4.6 (b/c 4.5 has issues) and used the annotation-based configuration, and voila, all is well.
Thank you.
I have 2 suggestions that might help. First, in the Run/Debug configuration, Make sure the JUnit 4 test runner is selected. Next, if this is a plugin project, add the junit4 runtime to the project as a dependency (in the dependencies tab).