How do I run Maven integration tests in alphabetical order? - maven

I'm using Maven 3.3.3 with Java 1.8. How do I get my integration tests to run in alphabetaical order, by class name (or file, whatever's easier)? I thought "runOrder" might help me so I created this plugin configuration ...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<reuseForks>true</reuseForks>
<argLine>-Xmx4096m -XX:MaxPermSize=512M -noverify -XX:-UseSplitVerifier ${itCoverageAgent}</argLine>
<runOrder>alphabetical</runOrder>
<skipTests>${skipAllTests}</skipTests>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
but as the integration tests are run, they are still not being run in order. Notice a file beginning with "V" precedess one beginnign with "G" ...
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
Running org.mainco.subco.antivirus.queue.repo.VirusScanQueueDaoIT
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.196 sec - in org.mainco.subco.antivirus.queue.repo.VirusScanQueueDaoIT
Running org.mainco.subco.antivirus.queue.service.VirusScanQueueServiceIT
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.055 sec - in org.mainco.subco.antivirus.queue.service.VirusScanQueueServiceIT
Running org.mainco.subco.classroom.repo.GroupDaoIT
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.181 sec - in org.mainco.subco.classroom.repo.GroupDaoIT
Running org.mainco.subco.classroom.service.GroupServiceIT
Tests run: 21, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.114 sec - in org.mainco.subco.classroom.service.GroupServiceIT
Running org.mainco.subco.core.repo.CategoryDaoIT

The ITs are run with respect to the alphabetical order... of the fully qualified name of the class. The following list
org.mainco.subco.antivirus.queue.repo.VirusScanQueueDaoIT
org.mainco.subco.antivirus.queue.service.VirusScanQueueServiceIT
org.mainco.subco.classroom.repo.GroupDaoIT
org.mainco.subco.classroom.service.GroupServiceIT
org.mainco.subco.core.repo.CategoryDaoIT
follows this ordering. There are currently no run orders working with just the class name.

Related

Tycho integration test are not run (but Unit tests are..)

I have a multi module project with a plugin and fragment to test this plugin.
The build is done through maven/tycho. Maven v.3.8.4 and Tycho v2.6.0.
In the fragment I have 3 Unit and 1 Integration test, in the test folder:
test
├── CoreTestConstants.java
├── CoreUtils2Test.java
├── CoreUtils3Test.java
├── CoreUtilsIT.java
└── CoreUtilsTest.java
This is the pom of the fragment plugin:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<artifactId>com.tycho.rcp.core.test</artifactId>
<version>0.2.4-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<parent>
<groupId>com.tycho</groupId>
<artifactId>com.tycho.mps</artifactId>
<version>0.3.4-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<executions>
<execution>
<id>it-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
<configuration>
<testSourceDirectory>src</testSourceDirectory>
<testClassesDirectory>target/classes</testClassesDirectory>
<!-- workspace directory -->
<osgiDataDirectory>${mas.test.workspace}</osgiDataDirectory>
<!-- system properties -->
<systemProperties>
<mas.test.archive_location>${mas.test.archive_location}</mas.test.archive_location>
</systemProperties>
<!-- add slf4j implementation dependency from Orbit -->
<dependencies>
<dependency>
<groupId>org.eclipse.orbit.bundles</groupId>
<artifactId>ch.qos.logback.slf4j</artifactId>
<version>1.1.2</version>
<type>eclipse-plugin</type>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
The tycho-surefire-plugin is enabled in pluginManagement of the parent project:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
</plugin>
The 3 Unit test are executed correctly, but the IT test is never run!
This is the relevant part of the output, when I run mvn clean verify inside the fragment project:
[INFO] --- tycho-surefire-plugin:2.6.0:test (default-test) # com.marchesini.mas.rcp.core.test ---
[INFO] Executing Test Runtime with timeout 0, logs (if any) will be placed at: /home/gionata/runtime-EclipseApplication/.metadata/.log
[INFO] Command line:
[/usr/lib/jvm/java-11-openjdk-11.0.9.11-0.fc31.x86_64/bin/java, -Dosgi.noShutdown=false, -Dosgi.os=linux, -Dosgi.ws=gtk, -Dosgi.arch=x86_64, -Dosgi.clean=true, -Dmas.test.archive_location=/home/gionata/ARCHIVIO.BLK, -jar, /home/gionata/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.5.100.v20180827-1352/org.eclipse.equinox.launcher-1.5.100.v20180827-1352.jar, -data, /home/gionata/runtime-EclipseApplication, -install, /home/gionata/Workspace_Eclipse_Maven/MAS/MPS/com.marchesini.mas.rcp.core.test/target/work, -configuration, /home/gionata/Workspace_Eclipse_Maven/MAS/MPS/com.marchesini.mas.rcp.core.test/target/work/configuration, -application, org.eclipse.tycho.surefire.osgibooter.headlesstest, -testproperties, /home/gionata/Workspace_Eclipse_Maven/MAS/MPS/com.marchesini.mas.rcp.core.test/target/surefire.properties]
Running com.marchesini.mas.rcp.core.test.CoreUtils2Test
Logger launcher start...4
2022-02-05 18:36:11,221 DEBUG [main]: CHECKSUM 2 = 340351cde832c00505c88f3fe1a962d4
2022-02-05 18:36:11,442 DEBUG [main]: Workspace = /home/gionata/runtime-EclipseApplication
2022-02-05 18:36:11,442 DEBUG [main]: Archive location = /home/gionata/ARCHIVIO.BLK
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.569 s - in com.marchesini.mas.rcp.core.test.CoreUtils2Test
testCoreUtils2(com.marchesini.mas.rcp.core.test.CoreUtils2Test) Time elapsed: 0.226 s
Running com.marchesini.mas.rcp.core.test.CoreUtilsTest
#################################################################################
REPORT
CHECKSUM = 340351cde832c00505c88f3fe1a962d4
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in com.marchesini.mas.rcp.core.test.CoreUtilsTest
testCoreUtils(com.marchesini.mas.rcp.core.test.CoreUtilsTest) Time elapsed: 0.002 s
Running com.marchesini.mas.rcp.core.test.CoreUtils3Test
Logger launcher start...4
2022-02-05 18:36:11,537 DEBUG [main]: CHECKSUM 3 = 340351cde832c00505c88f3fe1a962d4
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 s - in com.marchesini.mas.rcp.core.test.CoreUtils3Test
testCoreUtils3(com.marchesini.mas.rcp.core.test.CoreUtils3Test) Time elapsed: 0.001 s
Results:
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO] All tests passed!
[INFO]
[INFO] --- tycho-surefire-plugin:2.6.0:integration-test (it-test) # com.marchesini.mas.rcp.core.test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
The execution it-test simply doesn't run anything! I have been wasting hours on this....
Thankyou for any help.
First of all, you shouldn't add any specific configuration if you follow the default conventions. Moreover, parameters like <testSourceDirectory>src</testSourceDirectory> are not read by the tycho surefire plugin. Moreover, there's no need to create products or features for what you need. The reason why it's not working it's because of a bug:
https://github.com/eclipse/tycho/issues/643
On a side note, I've updated the RELEASE notes
https://github.com/eclipse/tycho/pull/641
trying to document better the rationale behind the new goal (but, again, it does not work due to a bug)

Testing JakartaEE applications with Arquillian Payara Micro Remote

I'm trying to test a JakartaEE application with Arquillian in Maven. Since the productive application should be running on Payara Micro, I chose the Payara Micro Remote dependency for the communication with the remote server:
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.6.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fish.payara.arquillian</groupId>
<artifactId>payara-micro-remote</artifactId>
<version>2.2</version>
<scope>test</scope>
/dependency>
</dependencies>
When I executed the tests, I got the following error:
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.325 s <<< FAILURE! - in com.mycompany.SomeTestClass
[ERROR] com.mycompany.SomeTestClass Time elapsed: 1.325 s <<< ERROR!
java.lang.IllegalArgumentException: Deployment failed. Payara Micro Deployer at http://localhost:8080/micro-deployer returned 404
I also tried deploying Payara Micro Deployer to the remote Payara Micro Server like follows:
<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-micro-maven-plugin</artifactId>
<version>1.0.7</version>
<configuration>
<daemon>true</daemon>
<commandLineOptions>
<commandLineOption>
<key>--deployFromGAV</key>
<value>"fish.payara.arquillian,payara-micro-deployer,2.2"</value>
</commandLineOption>
</commandLineOptions>
</configuration>
<!-- ...some cother settings... -->
</plugin>
But this resulted in
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.34 s <<< FAILURE! - in com.mycompany.SomeTestClass
[ERROR] com.mycompany.SomeTestClass Time elapsed: 1.34 s <<< ERROR!
java.lang.IllegalArgumentException: Deployment failed. Payara Micro Deployer at http://localhost:8080/micro-deployer returned 403
What am I doing wrong? Is there any description or example project on how to get Arquillian with Payara Micro Remote working?
The Payara Micro version I'm using is 5.194.
Thank you in advance!
After checking the Payara Micro's deployed paths, which were
GET /payara-micro-deployer/application.wadl
DELETE /payara-micro-deployer/application/{name}
PUT /payara-micro-deployer/application/{name}
and digging into the source code of Payara Micro Remote connector's configuration (https://github.com/payara/ecosystem-arquillian-connectors/blob/master/payara-micro-remote/src/main/java/fish/payara/arquillian/container/payaramicro/remote/PayaraMicroRemoteContainerConfiguration.java)
/**
* Get path payara-micro-deployer resides at.
* #return
*/
public String getDeployerContextPath() {
return deployerContextPath;
}
I found the solution.
I had to configure Payara Micro's deployment path in the arquillian.xml as follows:
<configuration>
<property name="deployerContextPath">/payara-micro-deployer</property>
</configuration>

jacoco as surefire argLine - The command line is too long

I'm running Jacoco as an agent to surefire
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<argLine>${jacoco.agent.argLine}</argLine>
</configuration>
</plugin>
I'm configuring Jacoco with a large list of exclusions (constants and my deprecated classes) for my build-breaker.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<configuration>
<excludes>
<exclude>*/*Test</exclude>
<exclude>*/*Constants*</exclude>
<exclude>${jacoco.exclusions.list}</exclude>
</excludes>
</configuration>
What I'm getting is that when I go to run the tests I get the error:
T E S T S
-------------------------------------------------------
The command line is too long.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Is there another way to pass the exclusions list to Jacoco than on the agent parameter arglist on the command line? (Looking at the code it doesn't look like it)
My question is: How to pass the list of exclusions to the Jacoco agent running in surefire other than on the command line?
As of today JaCoCo Java Agent doesn't allow reading of options from files.
However you can specify agent via environment variable JAVA_TOOL_OPTIONS, which supposed to have bigger size limit than command line.
Also JaCoCo in offline mode (without agent) allows to provide configuration via file jacoco-agent.properties.

Why is TestNG running these test classes multiple times?

I'm running builds and tests on a CI server (Bamboo). I'm using TestNG to run my integration tests.
When I run my build and tests (using Maven), I see the following in the logs (this is an example, there are other classes affected too)
build 27-Dec-2013 19:06:35 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$18
build 27-Dec-2013 19:06:36 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:06:36 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.194 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$18
build 27-Dec-2013 19:06:36 Running c.v.p.i.c.ExerciseLifecycleForStaticAssetIntegrationTest$1
build 27-Dec-2013 19:06:36 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:06:36 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.188 sec - in c.v.p.i.c.ExerciseLifecycleForStaticAssetIntegrationTest$1
build 27-Dec-2013 19:06:36 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$25
build 27-Dec-2013 19:06:36 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:06:36 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.188 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$25
build 27-Dec-2013 19:06:37 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest
build 27-Dec-2013 19:06:37 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:07:57 Tests run: 21, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 80.748 sec <<< FAILURE! - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest
build 27-Dec-2013 19:07:57 testGetPostDescriptorForVersion(c.v.p.i.c.MultiChannelContentServiceIntegrationTest) Time elapsed: 0.066 sec <<< FAILURE!
build 27-Dec-2013 19:07:57 java.lang.AssertionError: expected:<1.0> but was:<null>
build 27-Dec-2013 19:07:57 at org.testng.AssertJUnit.assertEquals(AssertJUnit.java:101)
build 27-Dec-2013 19:07:57 at org.testng.AssertJUnit.assertEquals(AssertJUnit.java:108)
build 27-Dec-2013 19:07:57 at c.v.p.i.c.MultiChannelContentServiceIntegrationTest.checkFieldsThatShouldBeTheSameForAllVersions(MultiChannelContentServiceIntegrationTest.java:891)
build 27-Dec-2013 19:07:57 at c.v.p.i.c.MultiChannelContentServiceIntegrationTest.testGetPostDescriptorForVersion(MultiChannelContentServiceIntegrationTest.java:832)
build 27-Dec-2013 19:07:57
build 27-Dec-2013 19:07:58 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$24
build 27-Dec-2013 19:07:58 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:07:58 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.186 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$24
build 27-Dec-2013 19:07:58 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$15
build 27-Dec-2013 19:07:58 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:07:58 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.183 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$15
build 27-Dec-2013 19:07:58 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$11
build 27-Dec-2013 19:07:59 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:07:59 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.2 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$11
build 27-Dec-2013 19:07:59 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$2
build 27-Dec-2013 19:07:59 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:07:59 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.206 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$2
build 27-Dec-2013 19:07:59 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$22
build 27-Dec-2013 19:07:59 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:08:00 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.189 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$22
build 27-Dec-2013 19:08:00 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$7
build 27-Dec-2013 19:08:00 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:08:00 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.19 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$7
build 27-Dec-2013 19:08:00 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$13
build 27-Dec-2013 19:08:00 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:08:00 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.199 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$13
build 27-Dec-2013 19:08:00 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$16
build 27-Dec-2013 19:08:01 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:08:01 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.214 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$16
build 27-Dec-2013 19:08:01 Running c.v.p.i.c.ExerciseLifecycleIntegrationTestTemplate
build 27-Dec-2013 19:08:01 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:08:01 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.229 sec - in c.v.p.i.c.ExerciseLifecycleIntegrationTestTemplate
build 27-Dec-2013 19:08:01 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$14
build 27-Dec-2013 19:08:01 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:08:02 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.184 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$14
build 27-Dec-2013 19:08:02 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$28
build 27-Dec-2013 19:08:02 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:08:02 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.186 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$28
build 27-Dec-2013 19:08:02 Running c.v.p.i.c.MultiChannelContentServiceIntegrationTest$5
build 27-Dec-2013 19:08:02 Configuring TestNG with: TestNGMapConfigurator
build 27-Dec-2013 19:08:02 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.191 sec - in c.v.p.i.c.MultiChannelContentServiceIntegrationTest$5
What I'm confused about is the instances of c.v.p.i.c.MultiChannelContentServiceIntegrationTest$XX.
I haven't intentionally or explicitly requested that the classes by run multiple times, nor does it seem that they are being run multiple times (since they report Test runs: 0 for all but a single instance).
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.16</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<argLine>
-javaagent:"${user.home}/.m2/repository/org/springframework/spring-instrument/${org.springframework.version}/spring-instrument-${org.springframework.version}.jar"
-Djava.awt.headless=true -Dehcache.rest.port=9888
</argLine>
<includes>
<include>c/v/p/integration/**/*.java</include>
</includes>
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
<argLine>-Xms512m -Xmx3096m -XX:PermSize=384m -XX:MaxPermSize=512m</argLine>
</configuration>
</execution>
</executions>
</plugin>
Can anyone point me towards what might be happening here. The phenomenon doesn't really lend itself to Googling. Most searches for "multiple test runs with TestNG" explain how to do it on purpose.
Are there any anonymous inner classes in your test class? That's what
MultiChannelContentServiceIntegrationTest$22 etc. seems to indicate.
Apparently, the pattern
<include>c/v/p/integration/**/*.java</include>
includes these anonymous classes, so Surefire tries to run them as test classes.
Try **/*Test.java or simply use the default.

How do I get Maven to print out the test names that failed?

I'm using Maven 3.0.3, JUnit 4.8.1, and Spring 3.1.1.RELEASE. I have my Surefire plugin configured this way
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<reuseForks>false</reuseForks>
<argLine>-Xmx2048m -XX:MaxPermSize=512M</argLine>
</configuration>
</plugin>
I notice when my unit tests fail because of IllegalStateExceptions, Maven never prints out the test names that failed at the end of execution. Instead I'll see
mvn clean install
...
Tests in error:
? IllegalState Failed to load ApplicationContext
? IllegalState Failed to load ApplicationContext
? IllegalState Failed to load ApplicationContext
? IllegalState Failed to load ApplicationContext
How can I get Mavne to print out more specific info about test failures? Right now I have to go digging through the surefire-reports directory to figure out what failed. Most of my JUnit tests look like this:
#RunWith(SpringJUnit4ClassRunner.class)
#ContextConfiguration({ "classpath:test-context.xml" })
public class CleverTeacherServiceTest extends AbstractImportServiceTest
{
I think your Spring test config is failing before your tests run. You should normally see the failed tests listed in the console, like:
T E S T S
Running TestSuite
..
Tests run: 234, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 7.019 sec <<< FAILURE!
fooTest(BarTest) Time elapsed: 0.011 sec <<< FAILURE!
fooTest(BarTest.java:23)
Results :
Failed tests:
BarTest.fooTest:23 null
Tests run: 234, Failures: 1, Errors: 0, Skipped: 0
You could run your tests setting the surefire plugin property useFile == false to have all the plugin output sent to the console. I wouldn't configure that in the pom file, but run it like so:
mvn -Dsurefire.useFile=false clean test
See Surefire Plugin docs for config information.

Resources