We have a multi-module Maven setup with a master pom.xml that includes all the others. So mvn test from the root directory runs all our unit tests, with textual output.
I can do Run / Run As / JUnit Test to run a single test class with a graphical test runner.
Question: How do I combine the two, so that I can run all the tests that mvn test runs but with a graphical runner, like the one from Run / Run As / JUnit Test?
Create an eclipse project with all your modules as Maven Dependecies and then create a JUnit Suite which incorporates all tests. Eclipse's JUnit Runner then will execute all declared Tests if you run this suite.
In Eclipse Juno, assuming your project is a Maven Project, you can just right click the project name in the Project Explorer and select Run As ... jUnit test. Alternatively you can produce the same text output you get from mvn test by selecting Run As ... Maven test
Related
I have an integration test with cucumber located in src/it directory
how can I run these tests because the JUnit test framework or any other cucumber-scala sbt plugin wants me to define all related stuff in src/test directory
I have configured one SBT multi-module project with scoverage plugin, which is working fine.
To generate test coverage, I am using > SBT clean coverage test coverageReport but is there any way to create a new task which chains internally coverage test coverageReport.
I have tried
Run custom task automatically before/after standard task to create a custom task, but it seems not working with multimodule project.
And one more - http://eed3si9n.com/sequencing-tasks-with-sbt-sequential
Try addCommandAlias like so
addCommandAlias("coverageAll", ";clean;coverage;test;coverageReport")
Now executing sbt coverageAll should generate coverage report for all the sub-projects.
I'm trying to add JUnit5 support in my Eclipse RCP application. It almost works, because for now I can:
Use Maven to build whole application and run tests with Tycho
Run single JUnit5 tests (creating run configuration on specific class) in
Eclipse
Run single JUnit5 tests in Run as JUnit Plug-in test mode in Eclipse
Run multiple JUnit5 tests in Run as JUnit test mode in Eclipse
What I'm trying to achieve now is to be able to run whole sets of test classes in plug-in test mode. For JUnit4-based plug-ins I could simply right-click on whole package or even whole plug-in and invoke Run As -> JUnit Plug-in test.
When I do the same operation on JUnit5 tests I get an error: No tests found with test runner 'JUnit 5'.
My current configuration for such plug-ins looks as follows:
According to official instructions in MANIFEST.FM I have Import-Package dependencies:
org.junit.jupiter.api,
org.junit.jupiter.params,
org.junit.jupiter.params.provider
and org.junit as Require-Bundle dependency
In order to run tests in Eclipse IDE I've also added JUnit 5 library to Java Build Path of the plugin. I coudn't add JUnit 5 runner dependencies to MANIFEST.FM instead, because of conflict with Tycho.
I can run:
a specific scala test
either by right clicking on the test and choose run
or if I have run it once previously, by selecting the test in run menu > run...
I can run all junit tests by making a new run/debug configuration > + > junit > test kind = all in package > search for tests = in whole project
I can run all scalatest (or junit) of one sub-project: right click on the project > run > scalatest in [module name]
But if I do the same as (2) with a scala test (+ > scala test > test kind...) the first test fails very strangely (it seems an object is not instantiated) while the same test pass if I run it using (1) or (3)
Config:
sbt with multiple subproject
intellij CE 15.0.2
scala plugin 2.1.0
scala 2.10
Bonus question: how to run all tests (junit and scalatest)?
You should be able to right click on the root directory of the project and click Run "All Tests". This recursively searches for tests in your project, and will run the tests in each module.
I am trying to run some Unit Tests written for a Mavenized project in Eclipse. The tests run perfectly fine from the command line. They also run perfectly fine if I open up Eclipse and run the tests directly off the POM file (i.e. right click on pom.xml and say run maven tests or whatever).
However, I get the following error when I run the tests as JUnit tests in Eclipse:
java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.test.ESIntegTestCase
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:340)
at com.carrotsearch.randomizedtesting.RandomizedRunner$1.run(RandomizedRunner.java:562)
I am using Elasticsearch version 2.1.0. The elasticsearch-2.1.0-tests.jar that contains org.elasticsearch.test.ESIntegTestCase is listed as a dependency in pom.xml and all Maven Dependencies show up in my Eclipse project's build path. I even tried specifically adding the jar to my buildpath and to the run configuration's classpath in Eclipse. Both do not work. Cleaning my project via Project -> Clean... also does not work.