Difference between `JUnit Plug-in Test` and `JUnit Test` in eclipse - eclipse

In the eclipse run command, there are two choices: JUnit Plug-in Test and JUnit Test.
Before, I tried to launch eclipse plugin test (org.eclipse.jdt.ui.tests.refactoring), and I had some issues ( Debugging eclipse unit test code "Test class should have exactly one" and "Workspace is closed" error ).
The issue was that when I tried to launch the debugger with JUnit Test, I got Workspace is closed error.
In eclipse configuration, they have the same workspace.
What is the difference between the two? And especially, how does workspace work for them?
Why I have Workspace is closed error with JUnit Test run? Is it possible to launch eclipse plugin test with JUnit Test?

JUnit Plug-in test is for testing Eclipse plug-ins. It runs a new instance of Eclipse. Then, it runs the tests.
JUnit test is for testing regular Java applications. It runs the tests without launching a new instance of Eclipse.

Related

Eclipse 2019-03 failing to run certain JUnit 4 tests from the Window but not Test suites or run configuration

I have installed Eclipse 2019-03 from both the installer and tar ball. Certain JUnit test will run from a "run as" selection in the window and others will not. The ones that will not run will run:
Test suite that includes the test class
Run -> run configurations
You can also run it from the JUnit view either from a test suite or run it again.
I have tried deleting then adding the code back in then which seems to work but then fails again in future.
I have tried re-installing eclipse and then adding the src and pom to the maven project and the issue is still there.
Any suggestions?
2019-06-28:
It seems there are also issues with this version of eclipse finding the main method in my Main class. Although removing or changing the code did resolve the issue there were a number of other issues croping up. I tried again to resolve this using both a new "run configuration" and run "Java Application". Both fail to find the class. This is a very simple Java 11 maven projet and I do not see why it is having these issues.
At this point I am going to roll back to a previous version of eclipse to see if it is having similar issues with this code.
2019-06-28 NEW:
Rolling back to photon resolved the issues with both running the code and the junit issues.
Version: Photon Release (4.8.0)
Build id: 20180619-1200

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.

how to "debug as maven test" in eclipse (sts)

I have written test cases in JUnit and they are executing fine when I use run as - maven test. But although I put debug points and select debug as - maven test, debugging does not work. I use maven-surefire-plugin. I am running the test cases in eclipse (STS) itself, there is no need for remote debug on an application running in server. These are simple test cases, testing some application code. Help would be much appreciated.
You can run the JUnit test directly in STS also for debugging. So no need to start Maven for that purpose.
Click on the Test Class you would like to debug. Right mouse button -> Debug As -> JUnit shoud do the trick.

Eclipse checkout SVN for JUnit testing

Im using Eclipse Juno. I imported a SVN (Subversion) project. I am trying to unit test the java classes on a module. I am using Java Perspective.
build path library has Junit4.
I have this Problems:
When im adding a new JUnit test case, the textbox from "class under test" has an error of "class under test doesnt exist in current project". But I just right clicked the java class I want to be tested and add new JUnit Test Case.So basically the error showing up doesnt make any sense. Because the class under test exist.
Theres no "run as JUnit Test" in the existing Java Test Class imported from SVN.
if I right clicked the test class > run as > run config only ***Theres no Junit Test
Eclipse Setup is Default except this settings:
in Window> Preferences > Java> Installed JRE > Jdk 1.7
in Window> Preferences > Maven > Installtion > Maven 3.0.4 (External)
Please Help me, consider me as a newbie in Unit Testing and in SVN Projects. I dont have any idea what to do.
Can anyone teach me how to create a Junit Test Case from a test class of a SVN Project.
Can You also Instruct the proper Eclipse Settings. (Files and Instructions)
Thanks in advance.
Add JUnit to your buildpath and it will solve some or both of your problems. I just tested this on Indigo though I couldn't recreate your first issue.

How to run scala BDD tests in Eclipse IDE

I'm trying to run this sample BDD test examples in my Eclipse IDE, but seems that in Run Configurations there are not suitable propositions for that? Also I couldn't find any suitable perspective for that.
What I'm supposed to do to run that test in my Eclipse IDE?
I'm aware that I can run a test (or set of tests) with the command line, but is there some integrated solutions in the Eclipse IDE?
This article explains how to run scalatest tests in eclipse.