surefire

How to pass java code a parameter from maven for testing

橙三吉。 提交于 2019-11-27 07:26:46
I need to pass on following values … exeEvironment (Test environment) , testGroup (Group in testNG) from Command-Line -> POM -> TestNG -> Test cases. Based on these two posts .... pass a java parameter from maven How to pass parameters to guicified TestNG test from Surefire Maven plugin? I did the following configuration .. In surefire plugin , I tried following two options, none seem to work. ===== (1) <execution> <id>default-test</id> <goals> <goal>test</goal> </goals> <configuration> <properties> <exeEnvironment>${exeEnvironment}</exeEnvironment> <testGroup>${testGroup}</testGroup> <

JUnit tests pass in Eclipse but fail in Maven Surefire

让人想犯罪 __ 提交于 2019-11-27 02:45:32
I have written some JUnit tests using JUnit 4 and spring-test libraries. When I run the tests inside Eclipse then run fine and pass. But when I run them using Maven (during the build process), they fail giving a spring related error. I am not sure what is causing the problem, JUnit, Surefire or Spring. Here is my test code, spring configuration and the exception that I get from Maven: PersonServiceTest.java package com.xyz.person.test; import static com.xyz.person.util.FjUtil.toFjList; import static junit.framework.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java

Run JUnit Tests contained in dependency jar using Maven Surefire

╄→尐↘猪︶ㄣ 提交于 2019-11-27 01:43:15
I have a jar in my maven repository that contains junit tests, which should be run in different projects, because it is able to inspect the project and test for certain features of it. Unforunately surefire doesn't pick up tests that are contained in a jar, as this Feature Request shows . In the feature request they propose to unpack the jar to be then executed by surefire. I successfully unpacked the jar using the maven-dependency-plugin, but the contained tests are not executed anyway. This is how I configured the maven-dependency-plugin to unpack my jar: <plugin> <groupId>org.apache.maven

Logging level under maven surefire

China☆狼群 提交于 2019-11-26 21:45:50
问题 I'm unable to adjust java logging's logging level. I'm using maven surefire (mvn test), and trying to adjust from the default INFO to e.g. FINEST. I have logging.properties file under src/test/resources/logging.properties after compile, i see under target/test-classes, i see a logging.properties file with the intended config: java.util.logging.ConsoleHandler.level=FINEST javax.enterprise.system.container.ejb.level=FINE ... however the console output from glassfish only have INFO / SEVERE

How to pass java code a parameter from maven for testing

南楼画角 提交于 2019-11-26 17:38:47
问题 I need to pass on following values … exeEvironment (Test environment) , testGroup (Group in testNG) from Command-Line -> POM -> TestNG -> Test cases. Based on these two posts .... pass a java parameter from maven How to pass parameters to guicified TestNG test from Surefire Maven plugin? I did the following configuration .. In surefire plugin , I tried following two options, none seem to work. ===== (1) <execution> <id>default-test</id> <goals> <goal>test</goal> </goals> <configuration>

How do I get my Maven Integration tests to run

放肆的年华 提交于 2019-11-26 15:35:20
I have a maven2 multi-module project and in each of my child modules I have JUnit tests that are named Test.java and Integration.java for unit tests and integration tests respectively. When I execute: mvn test all of the JUnit tests *Test.java within the child modules are executed. When I execute mvn test -Dtest=**/*Integration none of the Integration.java tests get execute within the child modules. These seem like the exact same command to me but the one with the -Dtest= /*Integration** does not work it displays 0 tests being run at the parent level, which there are not any tests serg10 You

Is there a decent HTML Junit report plugin for Maven?

别说谁变了你拦得住时间么 提交于 2019-11-26 15:32:09
问题 I find the surefire-report plug-in very unsuitable to my working style. I clean the project all the time and I don't want to spend 5 min to rebuild the whole site every time I want to look at the test report in my browser. If I type mvn surefire-report:report-only , the generated report is too ugly and barely readable. What I'm looking for is something like ant's JUnitReport task. Is there one available out there already? 回答1: Indeed, generating the whole site at each build is clearly not an

JUnit tests pass in Eclipse but fail in Maven Surefire

只愿长相守 提交于 2019-11-26 12:35:43
问题 I have written some JUnit tests using JUnit 4 and spring-test libraries. When I run the tests inside Eclipse then run fine and pass. But when I run them using Maven (during the build process), they fail giving a spring related error. I am not sure what is causing the problem, JUnit, Surefire or Spring. Here is my test code, spring configuration and the exception that I get from Maven: PersonServiceTest.java package com.xyz.person.test; import static com.xyz.person.util.FjUtil.toFjList; import

Making Maven run all tests, even when some fail

本秂侑毒 提交于 2019-11-26 10:06:28
问题 I have a project with several modules. When all tests pass, Maven test runs them all. When tests fail in the first module, maven will not continue to the next project. I have testFailureIgnore set to true in Surefire settings, but it doesn\'t help. How do I make maven run all tests? 回答1: From the documentation: -fae , --fail-at-end Only fail the build afterwards; allow all non-impacted builds to continue -fn , --fail-never NEVER fail the build, regardless of project result So if you are

Is there a way to tell surefire to skip tests in a certain package?

南楼画角 提交于 2019-11-26 09:50:13
问题 Something like the following. I would like a way to skip my dao tests in surefire. Trying to avoid overhead of defining Suites. With CI I\'d like to have one nightly that runs all tests and another 5 minute poll of SCM that runs only \'fast\' tests. mvn -DskipPattern=**.dao.** test 回答1: Let me extend Sean's answer. This is what you set in pom.xml : <properties> <exclude.tests>nothing-to-exclude</exclude.tests> </properties> <profiles> <profile> <id>fast</id> <properties> <exclude.tests>**/