surefire

How to show log4j output in surefire test resports

房东的猫 提交于 2020-01-01 01:53:13
问题 When a test fails in maven the surefire test report xml files in target/surefire-reports/TEST-<test-name>.xml only shows the Standard Output System.output or Standard Error System.err When I use the jdk java.util.logging.Logger all the logging shows in the Standard Error <system-err> tag , but it does not show when I use log4j. The logging with log4j is working fine through a FileAppender and a ConsoleAppender. It shows in the full console output, but not on the individual test report files.

Setting timezone for maven unit tests on Java 8

[亡魂溺海] 提交于 2019-12-28 05:32:05
问题 How do I set the timezone for unit tests in maven surefire on Java 8? With Java 7 this used to work with systemPropertyVariables like in the following configuration, but with Java 8 the tests just use the system timezone. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <systemPropertyVariables> <user.timezone>UTC</user.timezone> </systemPropertyVariables> Why is that, and how do I fix it? 回答1: Short answer Java now reads user

Surefire is not picking up Junit 4 tests

大憨熊 提交于 2019-12-28 03:45:10
问题 For some reason I cannot get Maven 2 Surefire plugin to execute JUnit 4 test class. public class SimpleTest { @org.junit.Test public void simple() { System.out.println("foo"); } } However if I change this class to be JUnit-3 like, such as public class SimpleTest extends junit.framework.TestCase { public void testBar() { System.out.println("bar"); } @org.junit.Test public void simple() { System.out.println("foo"); } } then it gets executed. Here's what I've done: verified Maven version: Apache

Setting up output directory of TestNG eclipse plugin

拜拜、爱过 提交于 2019-12-24 00:34:42
问题 I'd like to use both testNG eclipse plugin and maven surefire plugin together. And I was told here, that I can listen to the output folder "target/surefire-reports" when running maven test and the testNG plugin view takes the data and displays the results. But the view doesn't do anything after my "maven test" ends. And after I apply the testNG settings with "output folder", this error appears in eclipse error view Anyway the output directory is really set to target/surefire-reports but the

Maven Surefire Junit test suite

心已入冬 提交于 2019-12-23 17:27:00
问题 I am using the Maven Surefire plugin in order to run just a specific suite of tests. For instance: package suite; import org.junit.runner.RunWith; import org.junit.runners.Suite; import suite.slow.EvenSlowerClassTest; import suite.slow.SlowClassTest; @RunWith(Suite.class) @Suite.SuiteClasses({ SlowClassTest.class, EvenSlowerClassTest.class }) public class SlowSuite { } By using the maven command test -DrunSuite=**/FastSuite.class -DfailIfNoTests=false I can run the FastSuite or SlowSuite test

Excluding TestNG Groups From Maven

余生长醉 提交于 2019-12-21 21:26:53
问题 I have some slow tests that rely on the database that I don't want run every time I build my project with Maven. I've added the excludedGroups element to my pom file as explained http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#excludedGroups but I can't seem to get it working. I've created a minimal project. Here is the pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache

If I @Ignore a test class in JUnit4, does @BeforeClass still run?

橙三吉。 提交于 2019-12-21 07:55:43
问题 Quick background: I've been hunting down a Maven / Surefire test-running problem for days now, and I've narrowed it down to a small number suspect of tests. The behavior I'm seeing is insane . I start with mvn clean test : 250 tests run, 0 skipped. Now, I move the suspect test into src/test/java and try again: 146 tests run, 0 skipped! The output of Maven gives no clue that other tests aren't being run, even with the -X flag. That brings me to my question: the reason I call the test 'suspect'

Using custom reporters with the maven surefire plugin

为君一笑 提交于 2019-12-19 11:23:08
问题 I'm trying to use a custom reporter for TestNG with the maven surefire plugin. I already have a custom listener and that seems to get picked up. However, it doesn't look like the custom reporter is being used at all: <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <testFailureIgnore>false</testFailureIgnore> <properties> <property> <name>listener</name> <value>com.mystuff.test.TestNGListener</value> </property> <property> <name>reporter</name> <value>com.mystuff.test

Can't find JSTL tag library when running test under Maven Surefire

余生颓废 提交于 2019-12-19 10:17:36
问题 I have a Servlet-based application (OAuth implementation) which delegates some of the response rendering to JSP, as in the following example: private void doLoginPage( AuthorizationSession authzSession, String errorMsg, HttpServletRequest request, HttpServletResponse response ) throws OAuthSystemException { try { response.setHeader( HTTP.CONTENT_TYPE, ContentType.create( "text/html", "utf-8" ).toString() ); request.getRequestDispatcher( "/WEB-INF/OAuthLogin.jsp" ).include( request, response )

Does Maven surefire plugin run tests using multiple threads?

时间秒杀一切 提交于 2019-12-18 18:52:19
问题 I'm wondering if the Maven surefire plugin either runs tests multi-threaded by default (and if so can the number of threads be controlled? ) or if it runs tests from the Test classes in a random order or predictable order, or if the order can dictated by some means. I haven't verified this yet (I'll do so tomorrow just looking for some heads up guidance and verification at this point), but it looks as if my various JUnit Test classes are getting the tests run in some intermixed order. Which