You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-commits@maven.apache.org by ol...@apache.org on 2011/02/25 18:02:35 UTC
svn commit: r1074633 [1/2] - in /maven/surefire/trunk: ./
maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/
maven-surefire-common/src/main/java/org/apache/maven/p...
Author: olamy
Date: Fri Feb 25 17:02:32 2011
New Revision: 1074633
URL: http://svn.apache.org/viewvc?rev=1074633&view=rev
Log:
Merge branch 'trunk' of https://github.com/olamy/maven-surefire into trunk
Added:
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/SelectorUtils.java (with props)
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44TestMethodPatternIT.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44TestSingleMethodIT.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit48TestMethodPatternIT.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit48TestSingleMethodIT.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgTestMethodPatternIT.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgTestSingleMethod5149IT.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgTestSingleMethodIT.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-method-pattern/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-method-pattern/pom.xml (with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-method-pattern/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-method-pattern/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-method-pattern/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-method-pattern/src/test/java/junit4/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-method-pattern/src/test/java/junit4/BasicTest.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit4/src/test/java/junit4/BasicTest.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-single-method/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-single-method/pom.xml (with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-single-method/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-single-method/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-single-method/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-single-method/src/test/java/junit4/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit44-single-method/src/test/java/junit4/BasicTest.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit4/src/test/java/junit4/BasicTest.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-method-pattern/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-method-pattern/pom.xml (with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-method-pattern/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-method-pattern/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-method-pattern/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-method-pattern/src/test/java/junit4/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-method-pattern/src/test/java/junit4/BasicTest.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit4/src/test/java/junit4/BasicTest.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-single-method/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-single-method/pom.xml (with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-single-method/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-single-method/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-single-method/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-single-method/src/test/java/junit4/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-single-method/src/test/java/junit4/BasicTest.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit4/src/test/java/junit4/BasicTest.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-method-pattern/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-method-pattern/pom.xml (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-providers/surefire-testng/pom.xml
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-method-pattern/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-method-pattern/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-method-pattern/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-method-pattern/src/test/java/testng/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-method-pattern/src/test/java/testng/BasicTest.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit4/src/test/java/junit4/BasicTest.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method-5-14-9/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method-5-14-9/pom.xml (with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method-5-14-9/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method-5-14-9/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method-5-14-9/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method-5-14-9/src/test/java/testng/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method-5-14-9/src/test/java/testng/BasicTest.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit4/src/test/java/junit4/BasicTest.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method/pom.xml (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-providers/surefire-testng/pom.xml
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method/src/test/java/testng/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/testng-single-method/src/test/java/testng/BasicTest.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit4/src/test/java/junit4/BasicTest.java
maven/surefire/trunk/surefire-providers/surefire-testng-utils/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/pom.xml (with props)
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/main/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/main/java/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/main/java/org/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/main/java/org/apache/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/surefire/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/surefire/testng/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/surefire/testng/utils/
maven/surefire/trunk/surefire-providers/surefire-testng-utils/src/main/java/org/apache/maven/surefire/testng/utils/MethodSelector.java (contents, props changed)
- copied, changed from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire500PuzzlingErrorIT.java
Modified:
maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
maven/surefire/trunk/maven-surefire-plugin/pom.xml
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/api.apt
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/pojo-test.apt
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/providers.apt.vm
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt.vm
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt.vm
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt.vm
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/usage.apt
maven/surefire/trunk/pom.xml
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java
maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/util/SurefireDirectoryScannerTest.java
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
maven/surefire/trunk/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
maven/surefire/trunk/surefire-integration-tests/pom.xml
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire224WellFormedXmlFailuresIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire260TestWithIdenticalNamesIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire500PuzzlingErrorIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit4/src/test/java/junit4/BasicTest.java
maven/surefire/trunk/surefire-providers/pom.xml
maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java
maven/surefire/trunk/surefire-providers/surefire-testng/pom.xml
maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java
maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGProvider.java
Modified: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java Fri Feb 25 17:02:32 2011
@@ -193,15 +193,20 @@ public class IntegrationTestMojo
/**
* Specify this parameter to run individual tests by file name, overriding the <code>includes/excludes</code>
* parameters. Each pattern you specify here will be used to create an
- * include pattern formatted like <code>**/${test}.java</code>, so you can just type "-Dtest=MyTest"
+ * include pattern formatted like <code>**/${test}.java</code>, so you can just type "-Dit.test=MyTest"
* to run a single test called "foo/MyTest.java".<br/>
* This parameter overrides the <code>includes/excludes</code> parameters, and the TestNG
* <code>suiteXmlFiles</code> parameter.
+ *
+ * since 2.7.3
+ * You can execute a limited number of method in the test with adding #myMethod or #my*ethod.
+ * Si type "-Dtest=MyTest#myMethod"
+ * <b>supported for junit 4.x and testNg</b>
*
* @parameter expression="${it.test}"
*/
private String test;
-
+
/**
* A list of <include> elements specifying the tests (by pattern) that should be included in testing. When not
* specified and when the <code>test</code> parameter is not specified, the default includes will be
@@ -866,6 +871,15 @@ public class IntegrationTestMojo
public String getTest()
{
+ if ( StringUtils.isBlank( test ) )
+ {
+ return null;
+ }
+ int index = test.indexOf( '#' );
+ if ( index >= 0 )
+ {
+ return test.substring( 0, index );
+ }
return test;
}
@@ -873,6 +887,23 @@ public class IntegrationTestMojo
{
this.test = test;
}
+
+ /**
+ * @since 2.7.3
+ */
+ public String getTestMethod()
+ {
+ if ( StringUtils.isBlank( test ) )
+ {
+ return null;
+ }
+ int index = this.test.indexOf( '#' );
+ if ( index >= 0 )
+ {
+ return this.test.substring( index + 1, this.test.length() );
+ }
+ return null;
+ }
public List getIncludes()
{
@@ -1356,4 +1387,5 @@ public class IntegrationTestMojo
checksum.add(skipITs);
checksum.add(summaryFile);
}
+
}
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java Fri Feb 25 17:02:32 2011
@@ -310,7 +310,7 @@ public abstract class AbstractSurefireMo
TestArtifactInfo testNg =
isTestNg ? new TestArtifactInfo( testNgArtifact.getVersion(), testNgArtifact.getClassifier() ) : null;
List testXml = getSuiteXmlFiles() != null ? Arrays.asList( getSuiteXmlFiles() ) : null;
- TestRequest testSuiteDefinition = new TestRequest( testXml, getTestSourceDirectory(), getTest() );
+ TestRequest testSuiteDefinition = new TestRequest( testXml, getTestSourceDirectory(), getTest(), getTestMethod() );
final boolean failIfNoTests;
if ( isValidSuiteXmlFileConfig() && getTest() == null )
@@ -413,6 +413,18 @@ public abstract class AbstractSurefireMo
{
throw new MojoExecutionException( "Unable to generate test classpath: " + e, e );
}
+ catch ( ArtifactResolutionException e )
+ {
+ throw new MojoExecutionException( "Unable to generate test classpath: " + e, e );
+ }
+ catch ( ArtifactNotFoundException e )
+ {
+ throw new MojoExecutionException( "Unable to generate test classpath: " + e, e );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new MojoExecutionException( "Unable to generate test classpath: " + e, e );
+ }
addClasspathElementsToClasspathConfiguration(classpathElements, classpathConfiguration);
return new StartupConfiguration( providerName, classpathConfiguration, classLoaderConfiguration,
@@ -729,9 +741,13 @@ public abstract class AbstractSurefireMo
* when dependency resolution fails
* @throws org.apache.maven.plugin.MojoExecutionException
* upon other problems
+ * @throws InvalidVersionSpecificationException
+ * @throws MojoFailureException
+ * @throws ArtifactNotFoundException
+ * @throws ArtifactResolutionException
*/
public List generateTestClasspath()
- throws DependencyResolutionRequiredException, MojoExecutionException
+ throws DependencyResolutionRequiredException, MojoExecutionException, MojoFailureException, InvalidVersionSpecificationException, ArtifactResolutionException, ArtifactNotFoundException
{
List classpath = new ArrayList( 2 + getProject().getArtifacts().size() );
@@ -775,10 +791,32 @@ public abstract class AbstractSurefireMo
classpath.add( classpathElement );
}
}
+
+ // adding TestNG MethodSelector to the classpath
+ if ( getTestNgArtifact() != null )
+ {
+ Artifact testNgUtils = getTestNgUtilsArtifact();
+ String path = testNgUtils.getFile().getPath();
+ classpath.add( path );
+
+ }
return classpath;
}
+
+ protected Artifact getTestNgUtilsArtifact()
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ Artifact surefireArtifact = (Artifact) getPluginArtifactMap().get( "org.apache.maven.surefire:surefire-booter" );
+ String surefireVersion = surefireArtifact.getBaseVersion();
+ Artifact testNgUtils =
+ getArtifactFactory().createArtifact( "org.apache.maven.surefire", "surefire-testng-utils", surefireVersion,
+ "runtime", "jar" );
+ getArtifactResolver().resolve( testNgUtils, getRemoteRepositories(), getLocalRepository() );
+ return testNgUtils;
+ }
+
/**
* Return a new set containing only the artifacts accepted by the given filter.
*
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java Fri Feb 25 17:02:32 2011
@@ -145,7 +145,7 @@ public class SurefireDependencyResolver
}
Artifact originatingArtifact = artifactFactory.createBuildArtifact( "dummy", "dummy", "1.0", "jar" );
-
+
return artifactResolver.resolveTransitively( Collections.singleton( providerArtifact ), originatingArtifact,
localRepository, remoteRepositories, artifactMetadataSource,
filter );
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java Fri Feb 25 17:02:32 2011
@@ -89,6 +89,8 @@ public interface SurefireExecutionParame
void setTestSourceDirectory( File testSourceDirectory );
String getTest();
+
+ String getTestMethod();
void setTest( String test );
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java Fri Feb 25 17:02:32 2011
@@ -93,6 +93,7 @@ public class BooterSerializer
properties.setProperty( BooterConstants.SOURCE_DIRECTORY, testSuiteDefinition.getTestSourceDirectory() );
properties.addList( testSuiteDefinition.getSuiteXmlFiles(), BooterConstants.TEST_SUITE_XML_FILES );
properties.setProperty( BooterConstants.REQUESTEDTEST, testSuiteDefinition.getRequestedTest() );
+ properties.setProperty( BooterConstants.REQUESTEDTESTMETHOD, testSuiteDefinition.getRequestedTestMethod() );
}
DirectoryScannerParameters directoryScannerParameters = booterConfiguration.getDirScannerParams();
Modified: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerProviderConfigurationTest.java Fri Feb 25 17:02:32 2011
@@ -53,6 +53,8 @@ public class BooterDeserializerProviderC
private final String aTest = "aTest";
private final String aUserRequestedTest = "aUserRequestedTest";
+
+ private final String aUserRequestedTestMethod = "aUserRequestedTestMethod";
public static ClassLoaderConfiguration getForkConfiguration()
throws IOException
@@ -200,7 +202,7 @@ public class BooterDeserializerProviderC
ReporterConfiguration reporterConfiguration =
new ReporterConfiguration( reports, cwd, Boolean.TRUE, null );
TestRequest testSuiteDefinition =
- new TestRequest( getSuiteXmlFileStrings(), getTestSourceDirectory(), aUserRequestedTest );
+ new TestRequest( getSuiteXmlFileStrings(), getTestSourceDirectory(), aUserRequestedTest, aUserRequestedTestMethod );
return new ProviderConfiguration( directoryScannerParameters, true, reporterConfiguration,
new TestArtifactInfo( "5.0", "ABC" ), testSuiteDefinition, new Properties(),
aTest );
Modified: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java Fri Feb 25 17:02:32 2011
@@ -53,6 +53,8 @@ public class BooterDeserializerStartupCo
private final String aTest = "aTest";
private final String aUserRequestedTest = "aUserRequestedTest";
+
+ private final String aUserRequestedTestMethod = "aUserRequestedTestMethod";
public void testProvider()
throws IOException
@@ -136,7 +138,7 @@ public class BooterDeserializerStartupCo
ReporterConfiguration reporterConfiguration =
new ReporterConfiguration( new ArrayList(), cwd, Boolean.TRUE, null );
TestRequest testSuiteDefinition =
- new TestRequest( Arrays.asList( getSuiteXmlFileStrings() ), getTestSourceDirectory(), aUserRequestedTest );
+ new TestRequest( Arrays.asList( getSuiteXmlFileStrings() ), getTestSourceDirectory(), aUserRequestedTest, aUserRequestedTestMethod );
return new ProviderConfiguration( directoryScannerParameters, true, reporterConfiguration,
new TestArtifactInfo( "5.0", "ABC" ), testSuiteDefinition, new Properties(),
aTest );
Modified: maven/surefire/trunk/maven-surefire-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/pom.xml?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/pom.xml (original)
+++ maven/surefire/trunk/maven-surefire-plugin/pom.xml Fri Feb 25 17:02:32 2011
@@ -184,6 +184,7 @@
</executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<configuration>
<stagingSiteURL>scp://people.apache.org/www/maven.apache.org/plugins/${project.artifactId}-${project.version}</stagingSiteURL>
Modified: maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java Fri Feb 25 17:02:32 2011
@@ -19,6 +19,13 @@ package org.apache.maven.plugin.surefire
* under the License.
*/
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -34,13 +41,7 @@ import org.apache.maven.surefire.booter.
import org.apache.maven.surefire.booter.SurefireBooterForkException;
import org.apache.maven.surefire.booter.SurefireExecutionException;
import org.apache.maven.toolchain.ToolchainManager;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import org.codehaus.plexus.util.StringUtils;
/**
* Run tests using Surefire.
@@ -179,7 +180,12 @@ public class SurefirePlugin
* to run a single test called "foo/MyTest.java".<br/>
* This parameter overrides the <code>includes/excludes</code> parameters, and the TestNG
* <code>suiteXmlFiles</code> parameter.
- *
+ *
+ * since 2.7.3
+ * You can execute a limited number of method in the test with adding #myMethod or #my*ethod.
+ * Si type "-Dtest=MyTest#myMethod"
+ * <b>supported for junit 4.x and testNg</b>
+ *
* @parameter expression="${test}"
*/
private String test;
@@ -794,8 +800,35 @@ public class SurefirePlugin
public String getTest()
{
+ if ( StringUtils.isBlank( test ) )
+ {
+ return null;
+ }
+ int index = test.indexOf( '#' );
+ if ( index >= 0 )
+ {
+ return test.substring( 0, index );
+ }
return test;
}
+
+ /**
+ * @since 2.7.3
+ */
+ public String getTestMethod()
+ {
+ if ( StringUtils.isBlank( test ) )
+ {
+ return null;
+ }
+ int index = this.test.indexOf( '#' );
+ if ( index >= 0 )
+ {
+ return this.test.substring( index + 1, this.test.length() );
+ }
+ return null;
+ }
+
public void setTest( String test )
{
@@ -1266,4 +1299,5 @@ public class SurefirePlugin
protected void addPluginSpecificChecksumItems( ChecksumCalculator checksum )
{
}
+
}
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/api.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/api.apt?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/api.apt (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/api.apt Fri Feb 25 17:02:32 2011
@@ -5,6 +5,26 @@
------
2010-12-09
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm Fri Feb 25 17:02:32 2011
@@ -6,6 +6,26 @@
2010-01-09
------
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
+
Classloading and Forking in Maven Surefire
This page discusses classloading and forking under Maven Surefire, with an eye
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm Fri Feb 25 17:02:32 2011
@@ -5,6 +5,26 @@
------
2010-01-09
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
The Default Classpath
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt Fri Feb 25 17:02:32 2011
@@ -5,6 +5,26 @@
------
2010-01-09
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
Debugging Tests
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm Fri Feb 25 17:02:32 2011
@@ -5,6 +5,26 @@
------
2010-01-09
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
Inclusions and Exclusions of Tests
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm Fri Feb 25 17:02:32 2011
@@ -5,6 +5,26 @@
------
2010-10-10
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
Using JUnit
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/pojo-test.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/pojo-test.apt?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/pojo-test.apt (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/pojo-test.apt Fri Feb 25 17:02:32 2011
@@ -5,6 +5,26 @@
------
May 2008
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
Defining a POJO Test
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/providers.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/providers.apt.vm?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/providers.apt.vm (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/providers.apt.vm Fri Feb 25 17:02:32 2011
@@ -5,6 +5,26 @@
------
2010-12-04
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
Selecting providers
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt Fri Feb 25 17:02:32 2011
@@ -2,9 +2,30 @@
Running a Single Test
------
Allan Ramirez
+ Olivier Lamy
------
- July 2006
+ 2011-02-24
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
Running a Single Test
@@ -28,3 +49,21 @@ mvn -Dtest=TestCi*le test
+---+
mvn -Dtest=TestSquare,TestCi*le test
+---+
+
+Running a set of methods in a Single Test Class
+
+ With version 2.7.3, you can run only n tests in a single Test Class.
+
+ << NOTE : it's supported for junit 4.x and TestNG. >>
+
+ You must use the following syntax
+
++---+
+mvn -Dtest=TestCircle#mytest test
++---+
+
+ You can use patterns too
+
++---+
+mvn -Dtest=TestCircle#*test* test
++---+
\ No newline at end of file
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt.vm?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt.vm (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt.vm Fri Feb 25 17:02:32 2011
@@ -7,6 +7,26 @@
------
July 2006
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
Skipping Tests
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt.vm?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt.vm (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt.vm Fri Feb 25 17:02:32 2011
@@ -6,6 +6,26 @@
------
2010-01-09
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
Using System Properties
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt.vm?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt.vm (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt.vm Fri Feb 25 17:02:32 2011
@@ -5,6 +5,26 @@
------
2010-01-09
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
Using TestNG
@@ -44,7 +64,7 @@ Using TestNG
by Surefire as TestNG tests.
If you'd like to use a different naming scheme, you can change the <<<includes>>> parameter, as discussed in the
- {{{inclusion-exclusion.html}Inclusions and Exclusions of Tests}} example.
+ {{{./inclusion-exclusion.html}Inclusions and Exclusions of Tests}} example.
* Using Suite XML Files
@@ -88,7 +108,7 @@ Using TestNG
[...]
+---+
- For more information about setting system properties in Surefire tests, see {{{system-properties.html}System Properties}}.
+ For more information about setting system properties in Surefire tests, see {{{./system-properties.html}System Properties}}.
* Using Groups
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt Fri Feb 25 17:02:32 2011
@@ -5,6 +5,26 @@
------
July 2006
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/usage.apt?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/usage.apt (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/usage.apt Fri Feb 25 17:02:32 2011
@@ -6,6 +6,26 @@
------
2010-01-09
------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
@@ -61,7 +81,7 @@ mvn test
public in the class, but the API dependency is not required. To perform
assertions, the JDK 1.4 <<<assert>>> keyword can be used, or you can use
<<<org.apache.maven.surefire.assertion.Assert>>>.
- See {{{examples/pojo-test.html} using POJO tests}} for more information.
+ See {{{./examples/pojo-test.html} using POJO tests}} for more information.
All of the providers support the Surefire Plugin parameter configurations.
However, there are additional options available if you are running TestNG
Modified: maven/surefire/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/pom.xml?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/pom.xml (original)
+++ maven/surefire/trunk/pom.xml Fri Feb 25 17:02:32 2011
@@ -23,7 +23,7 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.apache.maven</groupId>
- <version>18</version>
+ <version>19</version>
<relativePath>../pom/maven/pom.xml</relativePath>
</parent>
@@ -253,15 +253,6 @@
<target>1.3</target>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.4.3</version>
- </plugin>
- <plugin>
- <artifactId>maven-site-plugin</artifactId>
- <version>2.2</version>
- </plugin>
</plugins>
</pluginManagement>
</build>
Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java Fri Feb 25 17:02:32 2011
@@ -143,10 +143,13 @@ public class SurefireReflector
{
return null;
}
- Class[] arguments = { List.class, File.class, String.class };
+ Class[] arguments = { List.class, File.class, String.class, String.class };
Constructor constructor = ReflectionUtils.getConstructor( this.testRequest, arguments );
- return ReflectionUtils.newInstance( constructor, new Object[]{ suiteDefinition.getSuiteXmlFiles(),
- suiteDefinition.getTestSourceDirectory(), suiteDefinition.getRequestedTest() } );
+ return ReflectionUtils.newInstance( constructor, new Object[] {
+ suiteDefinition.getSuiteXmlFiles(),
+ suiteDefinition.getTestSourceDirectory(),
+ suiteDefinition.getRequestedTest(),
+ suiteDefinition.getRequestedTestMethod() } );
}
Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestRequest.java Fri Feb 25 17:02:32 2011
@@ -35,12 +35,26 @@ public class TestRequest
private final File testSourceDirectory;
private final String requestedTest;
+
+ /**
+ * @since 2.7.3
+ */
+ private final String requestedTestMethod;
public TestRequest( List suiteXmlFiles, File testSourceDirectory, String requestedTest )
{
+ this( suiteXmlFiles, testSourceDirectory, requestedTest, null );
+ }
+
+ /**
+ * @since 2.7.3
+ */
+ public TestRequest( List suiteXmlFiles, File testSourceDirectory, String requestedTest, String requestedTestMethod )
+ {
this.suiteXmlFiles = createFiles( suiteXmlFiles );
this.testSourceDirectory = testSourceDirectory;
this.requestedTest = requestedTest;
+ this.requestedTestMethod = requestedTestMethod;
}
/**
@@ -69,6 +83,16 @@ public class TestRequest
{
return requestedTest;
}
+
+ /**
+ * A specific test request method issued with -Dtest=class#method from the command line.
+ * @return The string specified at the command line
+ * @since 2.7.3
+ */
+ public String getRequestedTestMethod()
+ {
+ return requestedTestMethod;
+ }
private static List createFiles( List suiteXmlFiles )
{
Added: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/SelectorUtils.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/SelectorUtils.java?rev=1074633&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/SelectorUtils.java (added)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/SelectorUtils.java Fri Feb 25 17:02:32 2011
@@ -0,0 +1,259 @@
+package org.apache.maven.surefire.util.internal;
+
+/*
+ * 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.
+ */
+
+
+/**
+ * <p>This is a utility class used by selectors and DirectoryScanner. The
+ * functionality more properly belongs just to selectors, but unfortunately
+ * DirectoryScanner exposed these as protected methods. Thus we have to
+ * support any subclasses of DirectoryScanner that may access these methods.
+ * </p>
+ * <p>This is a Singleton.</p>
+ *
+ * @author Arnout J. Kuiper
+ * <a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>
+ * @author Magesh Umasankar
+ * @author <a href="mailto:bruce@callenish.com">Bruce Atherton</a>
+ * @since 1.5
+ * @version $Id$
+ */
+public class SelectorUtils
+{
+
+ /**
+ * Private Constructor
+ */
+ private SelectorUtils()
+ {
+ // noop
+ }
+
+ /**
+ * Tests whether or not a string matches against a pattern.
+ * The pattern may contain two special characters:<br>
+ * '*' means zero or more characters<br>
+ * '?' means one and only one character
+ *
+ * @param pattern The pattern to match against.
+ * Must not be <code>null</code>.
+ * @param str The string which must be matched against the pattern.
+ * Must not be <code>null</code>.
+ *
+ * @return <code>true</code> if the string matches against the pattern,
+ * or <code>false</code> otherwise.
+ */
+ public static boolean match( String pattern, String str )
+ {
+ return match( pattern, str, true );
+ }
+
+ /**
+ * Tests whether or not a string matches against a pattern.
+ * The pattern may contain two special characters:<br>
+ * '*' means zero or more characters<br>
+ * '?' means one and only one character
+ *
+ * @param pattern The pattern to match against.
+ * Must not be <code>null</code>.
+ * @param str The string which must be matched against the pattern.
+ * Must not be <code>null</code>.
+ * @param isCaseSensitive Whether or not matching should be performed
+ * case sensitively.
+ *
+ *
+ * @return <code>true</code> if the string matches against the pattern,
+ * or <code>false</code> otherwise.
+ */
+ public static boolean match( String pattern, String str,
+ boolean isCaseSensitive )
+ {
+ char[] patArr = pattern.toCharArray();
+ char[] strArr = str.toCharArray();
+ int patIdxStart = 0;
+ int patIdxEnd = patArr.length - 1;
+ int strIdxStart = 0;
+ int strIdxEnd = strArr.length - 1;
+ char ch;
+
+ boolean containsStar = false;
+ for ( int i = 0; i < patArr.length; i++ )
+ {
+ if ( patArr[i] == '*' )
+ {
+ containsStar = true;
+ break;
+ }
+ }
+
+ if ( !containsStar )
+ {
+ // No '*'s, so we make a shortcut
+ if ( patIdxEnd != strIdxEnd )
+ {
+ return false; // Pattern and string do not have the same size
+ }
+ for ( int i = 0; i <= patIdxEnd; i++ )
+ {
+ ch = patArr[i];
+ if ( ch != '?' && !equals( ch, strArr[i], isCaseSensitive ) )
+ {
+ return false; // Character mismatch
+ }
+ }
+ return true; // String matches against pattern
+ }
+
+ if ( patIdxEnd == 0 )
+ {
+ return true; // Pattern contains only '*', which matches anything
+ }
+
+ // Process characters before first star
+ while ( ( ch = patArr[patIdxStart] ) != '*' && strIdxStart <= strIdxEnd )
+ {
+ if ( ch != '?' && !equals( ch, strArr[strIdxStart], isCaseSensitive ) )
+ {
+ return false; // Character mismatch
+ }
+ patIdxStart++;
+ strIdxStart++;
+ }
+ if ( strIdxStart > strIdxEnd )
+ {
+ // All characters in the string are used. Check if only '*'s are
+ // left in the pattern. If so, we succeeded. Otherwise failure.
+ for ( int i = patIdxStart; i <= patIdxEnd; i++ )
+ {
+ if ( patArr[i] != '*' )
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // Process characters after last star
+ while ( ( ch = patArr[patIdxEnd] ) != '*' && strIdxStart <= strIdxEnd )
+ {
+ if ( ch != '?' && !equals( ch, strArr[strIdxEnd], isCaseSensitive ) )
+ {
+ return false; // Character mismatch
+ }
+ patIdxEnd--;
+ strIdxEnd--;
+ }
+ if ( strIdxStart > strIdxEnd )
+ {
+ // All characters in the string are used. Check if only '*'s are
+ // left in the pattern. If so, we succeeded. Otherwise failure.
+ for ( int i = patIdxStart; i <= patIdxEnd; i++ )
+ {
+ if ( patArr[i] != '*' )
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // process pattern between stars. padIdxStart and patIdxEnd point
+ // always to a '*'.
+ while ( patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd )
+ {
+ int patIdxTmp = -1;
+ for ( int i = patIdxStart + 1; i <= patIdxEnd; i++ )
+ {
+ if ( patArr[i] == '*' )
+ {
+ patIdxTmp = i;
+ break;
+ }
+ }
+ if ( patIdxTmp == patIdxStart + 1 )
+ {
+ // Two stars next to each other, skip the first one.
+ patIdxStart++;
+ continue;
+ }
+ // Find the pattern between padIdxStart & padIdxTmp in str between
+ // strIdxStart & strIdxEnd
+ int patLength = ( patIdxTmp - patIdxStart - 1 );
+ int strLength = ( strIdxEnd - strIdxStart + 1 );
+ int foundIdx = -1;
+ strLoop:
+ for ( int i = 0; i <= strLength - patLength; i++ )
+ {
+ for ( int j = 0; j < patLength; j++ )
+ {
+ ch = patArr[patIdxStart + j + 1];
+ if ( ch != '?' && !equals( ch, strArr[strIdxStart + i + j], isCaseSensitive ) )
+ {
+ continue strLoop;
+ }
+ }
+
+ foundIdx = strIdxStart + i;
+ break;
+ }
+
+ if ( foundIdx == -1 )
+ {
+ return false;
+ }
+
+ patIdxStart = patIdxTmp;
+ strIdxStart = foundIdx + patLength;
+ }
+
+ // All characters in the string are used. Check if only '*'s are left
+ // in the pattern. If so, we succeeded. Otherwise failure.
+ for ( int i = patIdxStart; i <= patIdxEnd; i++ )
+ {
+ if ( patArr[i] != '*' )
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Tests whether two characters are equal.
+ */
+ private static boolean equals( char c1, char c2, boolean isCaseSensitive )
+ {
+ if ( c1 == c2 )
+ {
+ return true;
+ }
+ if ( !isCaseSensitive )
+ {
+ // NOTE: Try both upper case and lower case as done by String.equalsIgnoreCase()
+ if ( Character.toUpperCase( c1 ) == Character.toUpperCase( c2 ) ||
+ Character.toLowerCase( c1 ) == Character.toLowerCase( c2 ) )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Propchange: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/SelectorUtils.java
------------------------------------------------------------------------------
svn:executable = *
Modified: maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/util/SurefireDirectoryScannerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/util/SurefireDirectoryScannerTest.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/util/SurefireDirectoryScannerTest.java (original)
+++ maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/util/SurefireDirectoryScannerTest.java Fri Feb 25 17:02:32 2011
@@ -25,6 +25,7 @@ import org.apache.maven.surefire.testset
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -36,7 +37,8 @@ public class SurefireDirectoryScannerTes
public void testLocateTestClasses()
throws IOException, TestSetFailedException
{
- File baseDir = new File( new File( "." ).getCanonicalPath() );
+ // use target as people can configure ide to compile in an other place than maven
+ File baseDir = new File( new File( "target" ).getCanonicalPath() );
List include = new ArrayList();
include.add( "**/*ZT*A.java" );
List exclude = new ArrayList();
@@ -45,6 +47,7 @@ public class SurefireDirectoryScannerTes
"filesystem" );
String[] classNames = surefireDirectoryScanner.collectTests();
assertNotNull( classNames );
+ System.out.println("classNames " + Arrays.asList( classNames ));
assertEquals( 4, classNames.length );
}
}
Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java Fri Feb 25 17:02:32 2011
@@ -47,6 +47,7 @@ public interface BooterConstants
String TESTARTIFACT_VERSION = "testFwJarVersion";
String TESTARTIFACT_CLASSIFIER = "testFwJarClassifier";
String REQUESTEDTEST = "requestedTest";
+ String REQUESTEDTESTMETHOD = "requestedTestMethod";
String SOURCE_DIRECTORY = "testSuiteDefinitionTestSourceDirectory";
String TEST_CLASSES_DIRECTORY = "testClassesDirectory";
String RUN_ORDER = "runOrder";
Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java Fri Feb 25 17:02:32 2011
@@ -66,6 +66,7 @@ public class BooterDeserializer
final String testArtifactClassifier = properties.getProperty( TESTARTIFACT_CLASSIFIER );
final Object testForFork = properties.getTypeDecoded( FORKTESTSET );
final String requestedTest = properties.getProperty( REQUESTEDTEST );
+ final String requestedTestMethod = properties.getProperty( REQUESTEDTESTMETHOD );
final File sourceDirectory = properties.getFileProperty( SOURCE_DIRECTORY );
final List reports = properties.getStringList( REPORT_PROPERTY_PREFIX );
@@ -81,7 +82,7 @@ public class BooterDeserializer
properties.getBooleanObjectProperty( FAILIFNOTESTS ), runOrder );
TestArtifactInfo testNg = new TestArtifactInfo( testNgVersion, testArtifactClassifier );
- TestRequest testSuiteDefinition = new TestRequest( testSuiteXmlFiles, sourceDirectory, requestedTest );
+ TestRequest testSuiteDefinition = new TestRequest( testSuiteXmlFiles, sourceDirectory, requestedTest, requestedTestMethod );
ReporterConfiguration reporterConfiguration = new ReporterConfiguration( reports, reportsDirectory,
properties.getBooleanObjectProperty(
Modified: maven/surefire/trunk/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java (original)
+++ maven/surefire/trunk/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java Fri Feb 25 17:02:32 2011
@@ -63,7 +63,7 @@ public class SurefireReflectorTest
TestRequest testSuiteDefinition =
new TestRequest( Arrays.asList( new File[]{ new File( "file1" ), new File( "file2" ) } ),
- new File( "TestSOurce" ), "aUserRequestedTest" );
+ new File( "TestSOurce" ), "aUserRequestedTest", "aMethodRequested" );
surefireReflector.setTestSuiteDefinition( foo, testSuiteDefinition );
assertTrue( isCalled( foo ).booleanValue() );
}
Modified: maven/surefire/trunk/surefire-integration-tests/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/pom.xml?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/pom.xml (original)
+++ maven/surefire/trunk/surefire-integration-tests/pom.xml Fri Feb 25 17:02:32 2011
@@ -230,6 +230,10 @@
<name>maven.repo.local</name>
<value>${project.build.directory}/it-repo</value>
</property>
+ <property>
+ <name>maven.test.tmpdir</name>
+ <value>${project.build.directory}</value>
+ </property>
</systemProperties>
</configuration>
Copied: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java (from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java?p2=maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java&p1=maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java&r1=1074594&r2=1074633&rev=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java Fri Feb 25 17:02:32 2011
@@ -1,4 +1,6 @@
package org.apache.maven.surefire.its;
+
+import java.util.Arrays;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,29 +20,25 @@ package org.apache.maven.surefire.its;
* under the License.
*/
-import org.apache.maven.it.Verifier;
-import org.apache.maven.it.util.ResourceExtractor;
-
-import java.io.File;
/**
- * Test JUnit 4 tests marked with "Ignore" attribute
+ * Test project using -Dtest=mtClass#myMethod
*
- * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ * @author <a href="mailto:olamy@apache.org">Olivier Lamy</a>
*/
-public class Junit4IgnoreIT
+public abstract class AbstractTestSingleMethod
extends SurefireVerifierTestClass
{
- public Junit4IgnoreIT()
+ public AbstractTestSingleMethod(String projectResource)
{
- super( "/junit44-ignore");
+ super( projectResource );
}
- public void testJunit4Ignore()
+ public void testSingleMethod()
throws Exception
{
- executeTest( );
+ executeTest();
verifyErrorFreeLog();
- assertTestSuiteResults( 1, 0, 0, 1 );
+ assertTestSuiteResults( 1, 0, 0, 0 );
}
}
Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java
------------------------------------------------------------------------------
svn:executable = *
Copied: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java (from r1074594, maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java?p2=maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java&p1=maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java&r1=1074594&r2=1074633&rev=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java Fri Feb 25 17:02:32 2011
@@ -1,4 +1,12 @@
package org.apache.maven.surefire.its;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.it.Verifier;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,29 +27,23 @@ package org.apache.maven.surefire.its;
*/
-import org.apache.maven.it.Verifier;
-import org.apache.maven.it.util.ResourceExtractor;
-
-import java.io.File;
-
/**
- * Test JUnit 4 tests marked with "Ignore" attribute
+ * Test project using -Dtest=mtClass#myMethod
*
- * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ * @author <a href="mailto:olamy@apache.org">Olivier Lamy</a>
*/
-public class JUnit4ForkAlwaysStaticInitPollutionIT
+public abstract class AsbtractTestMethodPattern
extends SurefireVerifierTestClass
{
-
- public JUnit4ForkAlwaysStaticInitPollutionIT()
+ public AsbtractTestMethodPattern(String projectResource)
{
- super( "/junit4-forkAlways-staticInit" );
+ super( projectResource );
}
- public void testJunit4Ignore()
+ public void testMethodPattern()
throws Exception
{
- this.executeTest( );
+ executeTest();
verifyErrorFreeLog();
assertTestSuiteResults( 2, 0, 0, 0 );
}
Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java
------------------------------------------------------------------------------
svn:executable = *
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java Fri Feb 25 17:02:32 2011
@@ -18,12 +18,10 @@ package org.apache.maven.surefire.its;
* under the License.
*/
-import junit.framework.Assert;
-import org.apache.maven.it.Verifier;
-import org.apache.maven.it.util.ResourceExtractor;
-
import java.io.File;
+import junit.framework.Assert;
+
/**
* Test surefire-report on TestNG test
*
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java?rev=1074633&r1=1074632&r2=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java Fri Feb 25 17:02:32 2011
@@ -19,9 +19,6 @@ package org.apache.maven.surefire.its;
*/
-import org.apache.maven.it.Verifier;
-import org.apache.maven.it.util.ResourceExtractor;
-
import java.io.File;
import java.util.List;
Copied: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44TestMethodPatternIT.java (from r1074594, maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44TestMethodPatternIT.java?p2=maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44TestMethodPatternIT.java&p1=maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java&r1=1074594&r2=1074633&rev=1074633&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44TestMethodPatternIT.java Fri Feb 25 17:02:32 2011
@@ -1,5 +1,4 @@
-package org.apache.maven.surefire.junit4;
-
+package org.apache.maven.surefire.its;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,20 +18,18 @@ package org.apache.maven.surefire.junit4
* under the License.
*/
-import org.apache.maven.surefire.testset.TestSetFailedException;
-import org.junit.runner.Request;
-import org.junit.runner.Runner;
-import org.junit.runner.notification.RunNotifier;
-public class JUnit4TestSet
+/**
+ * Test project using -Dtest=mtClass#myMethod
+ *
+ * @author <a href="mailto:olamy@apache.org">Olivier Lamy</a>
+ */
+public class JUnit44TestMethodPatternIT
+ extends AsbtractTestMethodPattern
{
-
- public static void execute( Class testClass, RunNotifier fNotifier )
- throws TestSetFailedException
+ public JUnit44TestMethodPatternIT()
{
- Runner junitTestRunner = Request.aClass( testClass ).getRunner();
-
- junitTestRunner.run( fNotifier );
+ super( "/junit44-method-pattern" );
}
-}
+}