maven-surefire-plugin

Running Unit Tests using Maven in Spring LTW Environment

♀尐吖头ヾ 提交于 2019-12-04 03:16:09
I am developing an application in a ddd architecture using Spring LoadTimeWeaving feature. The problem is i can run my Junit tests using eclipse but not through Maven. I have tried all the options given on various sites but it simply isn't working. I get the following exception: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [sun.misc.Launcher$AppClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method.

Unit test class runs old version in eclipse

荒凉一梦 提交于 2019-12-04 03:09:55
问题 I have a JUnit test class in my project which is updated incrementally - I add tests every few weeks and sometimes modify the tests' code. Surprisingly, when I run the test class using eclipse JUnit Runner 4, it runs my old code (before the update) and not the new one. I can change the code, add or remove tests but it still runs the old code. I tried to isolate the problem and run a single test that I've just written and got the infamous "Unrooted tests" error without any stack trace to give

Maven surefire arguments when running JUnit test via eclipse

眉间皱痕 提交于 2019-12-04 01:11:46
问题 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

Maven doesn't execute any unit test

£可爱£侵袭症+ 提交于 2019-12-03 11:01:01
I am using Maven with multi-modules. There are 3 projects. foo(the parent project) foo-core foo-bar I configure all the dependencies and plugins in foo 's pom: <modules> <module>../foo-core</module> <module>../foo-bar</module> </modules> <dependencyManagement> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <dependency> ... </dependency> </dependencies> </dependencyManagement> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin<

Howto add another test source folder to Maven and compile it to a separate folder?

断了今生、忘了曾经 提交于 2019-12-03 10:31:42
问题 I have the default src/test/java folder for our unit tests. A separate folder src/integration/java is available for the integration tests. I configured the maven-surefire-plugin to execute the unit/integration tests in their respective phases. This works great when the compiled classes are in the correct directory. Unfortunately Maven only supports one test source folder and one test output folder. With mavens build-helper plugin I could add another test-source folder but the compiled classes

Maven surefire and JDK 11

佐手、 提交于 2019-12-03 07:53:45
I'm trying to get Maven surefire to run under JDK 11 but I keep getting these errors: If I set reuseForks to true: Error occurred in starting fork, check output in log Process Exit Code: 1 at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:670) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:283) at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246) If I set it to false: Execution default-test of goal org.apache.maven.plugins:maven-surefire- plugin:3.0.0-M1:test failed: java.lang

Maven won't run tests

孤者浪人 提交于 2019-12-03 07:26:45
When running mvn test maven won't run all Test Classes. When I explicitly provide a class by adding -Dtest=PropertyTests the tests will be run. Here's my pom.xml: <?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>example</artifactId> <version>1.0</version> <properties> <java-version>1.6</java-version> <org.slf4j-version>1.6.6<

Benefits of Maven FailSafe Plugin

Deadly 提交于 2019-12-03 05:34:27
问题 I read Maven Failsafe plugin is designed specifically to run integration tests. Currently I'm working on a multi-module project and integration tests are in its own separate module, written in TestNg and run using Surefire plugin. We don't have conflicts with unit tests since only integration tests are run in the test phase in that module. And to set up the environment before the tests, and clean it after tests are run, @BeforeSuite @AfterSuite TestNg annotations are used. So there's no need

Howto add another test source folder to Maven and compile it to a separate folder?

三世轮回 提交于 2019-12-03 04:16:20
I have the default src/test/java folder for our unit tests. A separate folder src/integration/java is available for the integration tests. I configured the maven-surefire-plugin to execute the unit/integration tests in their respective phases. This works great when the compiled classes are in the correct directory. Unfortunately Maven only supports one test source folder and one test output folder. With mavens build-helper plugin I could add another test-source folder but the compiled classes will be generated into test-classes but I want to compile the classes from src/integration/java into

IntelliJ Error when running unit test: Could not find or load main class ${surefireArgLine}

半世苍凉 提交于 2019-12-02 19:55:29
I get the following error when running Unit tests in IntelliJ: Error: Could not find or load main class ${surefireArgLine}. I am using maven and in pom.xml I have: <properties> ... <surefire.argLine /> </properties> <build> <plugins> <plugin> <groupId>com.mysema.maven</groupId> <artifactId>apt-maven-plugin</artifactId> <version>1.1.1</version> <executions> <execution> <goals> <goal>process</goal> </goals> <configuration> <outputDirectory>target/generated-sources/java</outputDirectory> <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor> </configuration> </execution> <