Author: krosenvold Date: Mon Dec 5 21:18:35 2011 New Revision: 1210641 URL: http://svn.apache.org/viewvc?rev=1210641&view=rev Log: [SUREFIRE-793] JUnit47 provider reports incorrect time in the XML report
Fixed with IT Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java (with props) Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java?rev=1210641&r1=1210640&r2=1210641&view=diff ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java (original) +++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java Mon Dec 5 21:18:35 2011 @@ -419,6 +419,18 @@ public abstract class SurefireVerifierTe addD( "parallel", parallel ); } + + protected void parallelClasses() + { + parallel( "classes" ); + } + + protected void parallelMethods() + { + parallel( "methods" ); + } + + protected void addD( String variable, String value ) { addGoal( "-D" + variable + "=" + value); Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java?rev=1210641&view=auto ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java (added) +++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java Mon Dec 5 21:18:35 2011 @@ -0,0 +1,65 @@ +package org.apache.maven.surefire.its; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.List; +import org.apache.maven.surefire.its.misc.HelperAssertions; +import org.apache.maven.surefire.its.misc.ReportTestSuite; + +/** + * Test reported runtime + * + * @author Kristian Rosenvold + */ +public class XmlReporterRunTimeIT + extends SurefireVerifierTestClass +{ + + public XmlReporterRunTimeIT() + { + super( "/runorder-parallel" ); + } + + public void testForkModeAlways() + throws Exception + { + parallelMethods( ); + executeTest(); + + List<ReportTestSuite> reports = HelperAssertions.extractReports( ( new File[]{ getTestDir() } ) ); + for ( ReportTestSuite report : reports ) + { + if ( "runorder.parallel.Test1".equals( report.getFullClassName() ) ) + { + assertTrue( report.getTimeElapsed() >= 1.2f); + } + else if ( "runorder.parallel.Test2".equals( report.getFullClassName() ) ) + { + assertTrue( report.getTimeElapsed() >= 0.9f); + } + else + { + System.out.println( "report = " + report ); + } + } + + } + +} Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/XmlReporterRunTimeIT.java ------------------------------------------------------------------------------ svn:eol-style = native