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

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.

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.

Difference between `JUnit Plug-in Test` and `JUnit Test` in 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.

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.

How to setup development mode for Eclipse GWT-Maven project?

I'm using Eclipse Indigo on Win XP with Java 6. I have Maven 3.0.3 and have a GWT (2.1) project, which I have imported into Eclipse. How do I create a run configuration that will run the GWT project in develpoment mode? I tried a run configuration with these goals:
clean gwt:run
But this fails to run in debug mode, since my breakpoint immediately upon entering the "onModuleLoad" method never gets triggered.
Thanks, - Dave
Have you seen http://code.google.com/intl/fr-FR/eclipse/docs/faq.html#gwt_with_maven ?
Follow the "if you'really not able to use Eclipse for Java EE" steps for best experience.
You should run it with:
gwt:debug
For more information about goals check gwt-maven-plugin.