maven-surefire-plugin

Maven surefire arguments when running JUnit test via eclipse

非 Y 不嫁゛ 提交于 2019-12-01 04:13:43
A newbie question on Maven - Surefire - Eclipse - JUnit I have configured the maven-surefire-plugin in the pom file of my project to pass some additional JVM arguments as below: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven.surefire.plugin.version}</version> <configuration> <argLine>-d64 -Xms128m -Xmx4096m -XX:PermSize=512m -Duser.timezone=UTC -XX:-UseSplitVerifier</argLine> </configuration> </plugin> When I run a test case of this project from Eclipse as Run As->JUnit Test, though the classpath is correctly set, the

How to us Maven PDF Plugin to generate PDF from Surefire Report?

♀尐吖头ヾ 提交于 2019-12-01 00:49:56
after running my JUnit tests I use the Maven Surefire Report plugin (http://maven.apache.org/plugins/maven-surefire-report-plugin/) to generate a HTML test report. This results in the following file: ./target/site/surefire-report.html I know that there is a Maven PDF plugin to generate PDF files (http://maven.apache.org/plugins/maven-pdf-plugin/surefire-report.html). But I don't manage to get it working. I included it in my pom.xml: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pdf-plugin</artifactId> <executions> <execution> <id>pdf</id> <phase>test</phase> <goals>

How to run a maven goal when there is tests failures?

拈花ヽ惹草 提交于 2019-11-30 20:39:19
I would like to know if there is a way to execute a goal when there is test failures? Since maven stops its execution (fail fast mode) after encountering a test failure, is there any options to launch a goal when there is test failures? Regards. hairyhenderson I've been searching for a way to do this as well, with not much success. However, there is the following question which might provide some general hints: Maven reporting plugins do not execute if a unit test failure occurs The idea is that you would run mvn install (or whatever) first, and then run: mvn -Dmaven.test.skip=true your-plugin

Where should I put interface class for Junit @Category?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 19:38:57
I'd like to define project-wide interfaces, to be used in @Category annotations, and configure Maven to exclude their annotated tests when building the whole project. In the application project there's a test I'd like to categorize: @Category(Integration.class) @Test public void testExternalResource() { ... } The setting: I've set up a multi-module maven project: /container (has a pom with <modules> element) /parent (all other modules inherit from its pom. has no source, only pom) /util (other modules are depending on it) /infra /application (depending on infra and util, inherits from parent)

How to identify slow unit tests when using maven-surefire-plugin in parallel mode?

纵饮孤独 提交于 2019-11-30 18:17:31
With a view to managing / reducing our build times, I want to identify which unit tests are taking the most time - in a parallel test environment using the maven-surefire-plugin . We are using JUnit (4.10) for unit tests. We use maven (2.2.1 - some plugins we use don't yet support maven 3) as our primary build tool, and the maven-surefire-plugin (2.19) to run unit tests. We are using the maven-surefire-plugin in parallel mode , where both the individual methods are run in parallel and the unit test classes are run in parallel - this is very important, as it significantly reduces build unit

Execution time of tests in unit test class via maven surefire-report in a single file in summarized format

空扰寡人 提交于 2019-11-30 14:41:29
Can anyone let me know how can I get the time taken by each of the unit tests in a unit test class in a single file via maven-surefire ? I have seen my target/surefire-report it has files for each test. Basically I am looking for a single file with all the execution times summarized. If possible also sort the result by execution time of each test. I am using maven 3.5 & surefire-plugin 2.4.2 on MacOSX 10.12.6. The maven-surefire-plugin currently doesn't let you do this. It writes all the results in separate files. You could create a feature-request in its issue tracker , if you feel like this

How to run Maven surefire without printing out test results to the command line?

只谈情不闲聊 提交于 2019-11-30 14:05:52
I am running the Maven 3.1.0 Surefire plugin already with the --quiet option, however it still prints out the results of unit tests out to the command line, even if they all pass. Is there a way to only get it to print failures? The output I'd like to suppress if everything is fine looks like: ------------------------------------------------------- T E S T S ------------------------------------------------------- Running net.initech.project.dawgs.actionfactory.InterfaceActionFactoryTest Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.425 sec Running net.initech.project.dawgs

NoSuchMethodError with Hamcrest 1.3 & JUnit 4.11

ぃ、小莉子 提交于 2019-11-30 13:41:33
问题 Another instance of the NoSuchMethodError for the JUnit & Hamcrest combination. Offending code: assertThat(dirReader.document(0).getFields(), hasItem( new FeatureMatcher<IndexableField, String>(equalTo("Patisnummer"), "Field key", "Field key") { @Override protected String featureValueOf(IndexableField actual) { return actual.name(); } } )); Commented lines 152–157 in IndexerTest.java (commit ac72ce) Causes a NoSuchMethodError (see http://db.tt/qkkkTE78 for complete output): java.lang

Merging Integration and Unit test reports with JaCoCo

血红的双手。 提交于 2019-11-30 12:44:26
问题 I am generating failsafe and surefire reports with maven with the JaCoCo plugin, but I can only manage to get them in separate reports. I would like to have a overall coverage view (merge between both Unit Tests and Integration Tests) as well. After what I think was a thorough google search I could only found a way to do this with Sonar. Is there any simpler way to do this? Related question: Maven separate Unit Test and Integration Tests 回答1: You should take a look into the documentation of

Maven surefire: append to argLine

做~自己de王妃 提交于 2019-11-30 11:50:50
I have 2 profiles that may or may not be used together to run a group of tests. They each require different vmargs to run, but if they are used together it's ok to have them appended to each other. What I'm looking for is a way to set argLine to be the concatenation of its current value plus what I set. I was hoping it would as simple as <argLine>${argLine} -DnewVMArg</argLine> Is there something similar I can do to make this happen? I made an attempt at fixing it which results in maven getting stuck in a recursive cycle. It's documented below. My Most recent attempt was to define a property