maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <stephen.alan.conno...@gmail.com>
Subject Re: svn commit: r1232972 - 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-plugin/src/main/java/org/apache/maven/plug
Date Wed, 18 Jan 2012 19:01:12 GMT
Do we need corresponding tests for this on failsafe

- Stephen

---
Sent from my Android phone, so random spelling mistakes, random nonsense
words and other nonsense are a direct result of using swype to type on the
screen
On Jan 18, 2012 5:54 p.m., <jdcasey@apache.org> wrote:

> Author: jdcasey
> Date: Wed Jan 18 17:53:39 2012
> New Revision: 1232972
>
> URL: http://svn.apache.org/viewvc?rev=1232972&view=rev
> Log:
> [SUREFIRE-806] Detect when multiple test executions are configured, and if
> only a single execution is present, use specified tests for includes (if
> they're available), which is the old behavior. If multiple test executions
> are specified, then use the specified tests as a filter for the existing
> includes/excludes, to make sure each specified test executes in the
> appropriate configuration.
>
> Also, adding three integration tests to verify these include/exclude
> conditions, plus the functioning of the new failIfNoSpecifiedTests
> parameter.
>
> Added:
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckSingleTestIT.java.orig
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/pom.xml
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FirstTest.java
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FourthTest.java
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/SecondTest.java
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/ThirdTest.java
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/pom.xml
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FirstTest.java
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FourthTest.java
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/SecondTest.java
>   (with props)
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/ThirdTest.java
>   (with props)
> 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/SurefireExecutionParameters.java
>
>  maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
>
>  maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.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=1232972&r1=1232971&r2=1232972&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
> Wed Jan 18 17:53:39 2012
> @@ -38,6 +38,7 @@ import org.apache.maven.artifact.resolve
>  import org.apache.maven.execution.MavenSession;
>  import org.apache.maven.plugin.MojoExecutionException;
>  import org.apache.maven.plugin.MojoFailureException;
> +import org.apache.maven.plugin.descriptor.PluginDescriptor;
>  import org.apache.maven.plugin.surefire.AbstractSurefireMojo;
>  import org.apache.maven.plugin.surefire.Summary;
>  import org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator;
> @@ -67,6 +68,16 @@ public class IntegrationTestMojo
>  {
>
>     /**
> +     * Information about this plugin, mainly used to lookup this plugin's
> configuration from the currently executing
> +     * project.
> +     *
> +     * @parameter default-value="${plugin}"
> +     * @readonly
> +     * @since 2.12
> +     */
> +    private PluginDescriptor pluginDescriptor;
> +
> +    /**
>      * Set this to "true" to skip running tests, but still compile them.
> Its use is NOT RECOMMENDED, but quite
>      * convenient on occasion.
>      *
> @@ -1426,4 +1437,9 @@ public class IntegrationTestMojo
>         this.failIfNoSpecifiedTests = failIfNoSpecifiedTests;
>     }
>
> +    public PluginDescriptor getPluginDescriptor()
> +    {
> +        return pluginDescriptor;
> +    }
> +
>  }
>
> 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=1232972&r1=1232971&r2=1232972&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
> Wed Jan 18 17:53:39 2012
> @@ -42,12 +42,14 @@ import org.apache.maven.artifact.resolve
>  import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
>  import
> org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
>  import org.apache.maven.artifact.versioning.VersionRange;
> +import org.apache.maven.model.Plugin;
>  import org.apache.maven.plugin.AbstractMojo;
>  import org.apache.maven.plugin.MojoExecutionException;
>  import org.apache.maven.plugin.MojoFailureException;
>  import org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator;
>  import org.apache.maven.plugin.surefire.booterclient.ForkConfiguration;
>  import org.apache.maven.plugin.surefire.booterclient.ForkStarter;
> +import org.apache.maven.project.MavenProject;
>  import
> org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
>  import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
>  import org.apache.maven.surefire.booter.Classpath;
> @@ -546,7 +548,15 @@ public abstract class AbstractSurefireMo
>
>     private List<String> getIncludeList()
>     {
> -        List<String> includes = this.getIncludes();
> +        List<String> includes;
> +        if ( isSpecificTestSpecified() &&
> !isMultipleExecutionBlocksDetected() )
> +        {
> +            includes = getSpecificTests();
> +        }
> +        else
> +        {
> +            includes = this.getIncludes();
> +        }
>
>         // defaults here, qdox doesn't like the end javadoc value
>         // Have to wrap in an ArrayList as surefire expects an ArrayList
> instead of a List for some reason
> @@ -555,9 +565,30 @@ public abstract class AbstractSurefireMo
>             includes = new ArrayList<String>( Arrays.asList(
> getDefaultIncludes() ) );
>         }
>
> +        System.out.println( "Test includes:\n\n" + includes + "\n\n" );
> +
>         return includes;
>     }
>
> +    private boolean isMultipleExecutionBlocksDetected()
> +    {
> +        MavenProject project = getProject();
> +        if ( project != null )
> +        {
> +            String key = getPluginDescriptor().getPluginLookupKey();
> +            Plugin plugin = (Plugin)
> project.getBuild().getPluginsAsMap().get( key );
> +
> +            if ( plugin != null )
> +            {
> +                @SuppressWarnings( "rawtypes" )
> +                List executions = plugin.getExecutions();
> +                return executions != null && executions.size() > 1;
> +            }
> +        }
> +
> +        return false;
> +    }
> +
>     private List<String> getSpecificTests()
>     {
>         if ( !isSpecificTestSpecified() )
>
> 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=1232972&r1=1232971&r2=1232972&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
> Wed Jan 18 17:53:39 2012
> @@ -30,6 +30,7 @@ import org.apache.maven.artifact.metadat
>  import org.apache.maven.artifact.repository.ArtifactRepository;
>  import org.apache.maven.artifact.resolver.ArtifactResolver;
>  import org.apache.maven.execution.MavenSession;
> +import org.apache.maven.plugin.descriptor.PluginDescriptor;
>  import org.apache.maven.project.MavenProject;
>  import org.apache.maven.toolchain.ToolchainManager;
>
> @@ -123,6 +124,8 @@ public interface SurefireExecutionParame
>
>     void setProperties( Properties properties );
>
> +    PluginDescriptor getPluginDescriptor();
> +
>     Map<String,Artifact> getPluginArtifactMap();
>
>     void setPluginArtifactMap( Map<String,Artifact> pluginArtifactMap );
>
> 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=1232972&r1=1232971&r2=1232972&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
> Wed Jan 18 17:53:39 2012
> @@ -33,6 +33,7 @@ import org.apache.maven.artifact.resolve
>  import org.apache.maven.execution.MavenSession;
>  import org.apache.maven.plugin.MojoExecutionException;
>  import org.apache.maven.plugin.MojoFailureException;
> +import org.apache.maven.plugin.descriptor.PluginDescriptor;
>  import org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator;
>  import org.apache.maven.project.MavenProject;
>  import org.apache.maven.surefire.suite.RunResult;
> @@ -56,9 +57,19 @@ public class SurefirePlugin
>  {
>
>     /**
> +     * Information about this plugin, mainly used to lookup this plugin's
> configuration from the currently executing
> +     * project.
> +     *
> +     * @parameter default-value="${plugin}"
> +     * @readonly
> +     * @since 2.12
> +     */
> +    private PluginDescriptor pluginDescriptor;
> +
> +    /**
>      * Set this to "true" to skip running tests, but still compile them.
> Its use is NOT RECOMMENDED, but quite
>      * convenient on occasion.
> -     *
> +     *
>      * @parameter default-value="false" expression="${skipTests}"
>      * @since 2.4
>      */
> @@ -1347,4 +1358,9 @@ public class SurefirePlugin
>     {
>     }
>
> +    public PluginDescriptor getPluginDescriptor()
> +    {
> +        return pluginDescriptor;
> +    }
> +
>  }
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckSingleTestIT.java.orig
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckSingleTestIT.java.orig?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckSingleTestIT.java.orig
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckSingleTestIT.java.orig
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,71 @@
> +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 org.apache.maven.surefire.its.fixture.OutputValidator;
> +import org.apache.maven.surefire.its.fixture.SurefireLauncher;
> +import org.apache.maven.surefire.its.fixture.SurefireIntegrationTestCase;
> +import org.apache.maven.surefire.its.fixture.TestFile;
> +
> +/**
> + * Test running a single test with -Dtest=BasicTest
> + *
> + * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
> + * @author <a href="mailto:krosenvold@apache.org">Kristian Rosenvold</a>
> + */
> +public class CheckSingleTestIT
> +    extends SurefireIntegrationTestCase
> +{
> +    public void testSingleTest()
> +    {
> +        unpack().setTestToRun( "BasicTest"
> ).executeTest().verifyErrorFree( 1 );
> +    }
> +
> +    public void testSingleTestDotJava()
> +    {
> +        unpack().setTestToRun( "BasicTest.java"
> ).executeTest().verifyErrorFree( 1 );
> +    }
> +
> +    public void testSingleTestNonExistent()
> +    {
> +        final OutputValidator output = unpack().setTestToRun(
> "DoesNotExist" ).executeTestWithFailure();
> +        TestFile reportsDir = output.getTargetFile( "surefire-reports" );
> +        assertFalse( "Unexpected reports directory", reportsDir.exists()
> );
> +    }
> +
> +    public void testSingleTestNonExistentOverride()
> +    {
> +        final OutputValidator output =
> +            unpack().setTestToRun( "DoesNotExist" ).failIfNoTests( false
> ).executeTest().verifyErrorFreeLog();
> +        TestFile reportsDir = output.getTargetFile( "surefire-reports" );
> +        assertFalse( "Unexpected reports directory", reportsDir.exists()
> );
> +    }
> +
> +    public void testSingleTestInOneExecutionOfMultiExecutionProject()
> +    {
> +        unpack( "/default-configuration-multi-exec" ).setTestToRun(
> "FirstTest" ).addGoal( "-X" ).failIfNoSpecifiedTests( false
> ).executeTest().verifyErrorFree( 1 );
> +    }
> +
> +    private SurefireLauncher unpack()
> +    {
> +        return unpack( "/default-configuration" );
> +    }
> +
> +}
>
> Modified:
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java?rev=1232972&r1=1232971&r2=1232972&view=diff
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
> (original)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
> Wed Jan 18 17:53:39 2012
> @@ -333,6 +333,12 @@ public class SurefireLauncher
>         return addGoal( "-DfailIfNoTests=" + fail );
>     }
>
> +    public SurefireLauncher failIfNoSpecifiedTests( boolean fail )
> +    {
> +        this.failIfNoTests = fail;
> +        return addGoal( "-Dsurefire.failIfNoSpecifiedTests=" + fail );
> +    }
> +
>     public SurefireLauncher useSystemClassLoader( boolean
> useSystemClassLoader)
>     {
>         return addGoal( "-DuseSystemClassLoader=" + useSystemClassLoader );
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,24 @@
> +package org.apache.maven.surefire.its.jiras;
> +
> +import org.apache.maven.surefire.its.fixture.SurefireIntegrationTestCase;
> +
> +public class Surefire806SpecifiedTestControlsIT
> +    extends SurefireIntegrationTestCase
> +{
> +
> +    public void testSingleTestInOneExecutionOfMultiExecutionProject()
> +    {
> +        unpack( "/surefire-806-specifiedTests-multi" ).setTestToRun(
> "FirstTest" ).failIfNoSpecifiedTests( false
> ).executeTest().verifyErrorFree( 1 );
> +    }
> +
> +    public void testTwoSpecifiedTestExecutionsInCorrectExecutionBlocks()
> +    {
> +        unpack( "/surefire-806-specifiedTests-multi" ).setTestToRun(
> "FirstTest,SecondTest" ).executeTest().verifyErrorFree( 2 );
> +    }
> +
> +    public void testSingleTestInSingleExecutionProject()
> +    {
> +        unpack( "/surefire-806-specifiedTests-single" ).setTestToRun(
> "ThirdTest" ).failIfNoSpecifiedTests( false
> ).executeTest().verifyErrorFree( 1 );
> +    }
> +
> +}
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/pom.xml
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/pom.xml?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/pom.xml
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/pom.xml
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,81 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +  ~ 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.
> +  -->
> +
> +<project xmlns="http://maven.apache.org/POM/4.0.0"
> +         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> +  <modelVersion>4.0.0</modelVersion>
> +
> +  <groupId>org.apache.maven.plugins.surefire</groupId>
> +  <artifactId>default-configuration-multi-exec</artifactId>
> +  <version>1.0-SNAPSHOT</version>
> +  <name>Test for single test in one of multiple executions</name>
> +
> +  <dependencies>
> +    <dependency>
> +      <groupId>junit</groupId>
> +      <artifactId>junit</artifactId>
> +      <version>3.8.1</version>
> +      <scope>test</scope>
> +    </dependency>
> +  </dependencies>
> +
> +  <build>
> +    <plugins>
> +      <plugin>
> +        <artifactId>maven-surefire-plugin</artifactId>
> +        <version>${surefire.version}</version>
> +        <executions>
> +          <execution>
> +            <id>default-test</id>
> +            <goals>
> +              <goal>test</goal>
> +            </goals>
> +            <configuration>
> +              <includes>
> +                <include>**/FirstTest.java</include>
> +                <include>**/ThirdTest.java</include>
> +              </includes>
> +              <systemPropertyVariables>
> +                <phaseName>first</phaseName>
> +              </systemPropertyVariables>
> +            </configuration>
> +          </execution>
> +          <execution>
> +            <id>second</id>
> +            <goals>
> +              <goal>test</goal>
> +            </goals>
> +            <configuration>
> +              <includes>
> +                <include>**/SecondTest.java</include>
> +                <include>**/FourthTest.java</include>
> +              </includes>
> +              <systemPropertyVariables>
> +                <phaseName>second</phaseName>
> +              </systemPropertyVariables>
> +            </configuration>
> +          </execution>
> +        </executions>
> +      </plugin>
> +    </plugins>
> +  </build>
> +
> +</project>
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/pom.xml
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FirstTest.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FirstTest.java?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FirstTest.java
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FirstTest.java
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,17 @@
> +package defaultConfiguration;
> +
> +import junit.extensions.TestSetup;
> +import junit.framework.Test;
> +import junit.framework.TestCase;
> +import junit.framework.TestSuite;
> +
> +public class FirstTest
> +    extends TestCase
> +{
> +
> +    public void testSetUp()
> +    {
> +        assertEquals( "first", System.getProperty( "phaseName" ) );
> +    }
> +
> +}
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FirstTest.java
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FourthTest.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FourthTest.java?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FourthTest.java
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FourthTest.java
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,17 @@
> +package defaultConfiguration;
> +
> +import junit.extensions.TestSetup;
> +import junit.framework.Test;
> +import junit.framework.TestCase;
> +import junit.framework.TestSuite;
> +
> +public class FourthTest
> +    extends TestCase
> +{
> +
> +    public void testSetUp()
> +    {
> +        assertEquals( "second", System.getProperty( "phaseName" ) );
> +    }
> +
> +}
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/FourthTest.java
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/SecondTest.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/SecondTest.java?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/SecondTest.java
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/SecondTest.java
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,17 @@
> +package defaultConfiguration;
> +
> +import junit.extensions.TestSetup;
> +import junit.framework.Test;
> +import junit.framework.TestCase;
> +import junit.framework.TestSuite;
> +
> +public class SecondTest
> +    extends TestCase
> +{
> +
> +    public void testSetUp()
> +    {
> +        assertEquals( "second", System.getProperty( "phaseName" ) );
> +    }
> +
> +}
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/SecondTest.java
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/ThirdTest.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/ThirdTest.java?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/ThirdTest.java
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/ThirdTest.java
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,17 @@
> +package defaultConfiguration;
> +
> +import junit.extensions.TestSetup;
> +import junit.framework.Test;
> +import junit.framework.TestCase;
> +import junit.framework.TestSuite;
> +
> +public class ThirdTest
> +    extends TestCase
> +{
> +
> +    public void testSetUp()
> +    {
> +        assertEquals( "first", System.getProperty( "phaseName" ) );
> +    }
> +
> +}
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-multi/src/test/java/defaultConfiguration/ThirdTest.java
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/pom.xml
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/pom.xml?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/pom.xml
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/pom.xml
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,65 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +  ~ 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.
> +  -->
> +
> +<project xmlns="http://maven.apache.org/POM/4.0.0"
> +         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> +         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> +  <modelVersion>4.0.0</modelVersion>
> +
> +  <groupId>org.apache.maven.plugins.surefire</groupId>
> +  <artifactId>default-configuration-multi-exec</artifactId>
> +  <version>1.0-SNAPSHOT</version>
> +  <name>Test for single test in one of multiple executions</name>
> +
> +  <dependencies>
> +    <dependency>
> +      <groupId>junit</groupId>
> +      <artifactId>junit</artifactId>
> +      <version>3.8.1</version>
> +      <scope>test</scope>
> +    </dependency>
> +  </dependencies>
> +
> +  <build>
> +    <plugins>
> +      <plugin>
> +        <artifactId>maven-surefire-plugin</artifactId>
> +        <version>${surefire.version}</version>
> +        <executions>
> +          <execution>
> +            <id>default-test</id>
> +            <goals>
> +              <goal>test</goal>
> +            </goals>
> +            <configuration>
> +              <includes>
> +                <include>**/FirstTest.java</include>
> +              </includes>
> +              <systemPropertyVariables>
> +                <phaseName>first</phaseName>
> +              </systemPropertyVariables>
> +            </configuration>
> +          </execution>
> +        </executions>
> +      </plugin>
> +    </plugins>
> +  </build>
> +
> +</project>
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/pom.xml
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FirstTest.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FirstTest.java?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FirstTest.java
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FirstTest.java
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,17 @@
> +package defaultConfiguration;
> +
> +import junit.extensions.TestSetup;
> +import junit.framework.Test;
> +import junit.framework.TestCase;
> +import junit.framework.TestSuite;
> +
> +public class FirstTest
> +    extends TestCase
> +{
> +
> +    public void testSetUp()
> +    {
> +        assertEquals( "FAIL", System.getProperty( "phaseName" ) );
> +    }
> +
> +}
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FirstTest.java
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FourthTest.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FourthTest.java?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FourthTest.java
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FourthTest.java
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,17 @@
> +package defaultConfiguration;
> +
> +import junit.extensions.TestSetup;
> +import junit.framework.Test;
> +import junit.framework.TestCase;
> +import junit.framework.TestSuite;
> +
> +public class FourthTest
> +    extends TestCase
> +{
> +
> +    public void testSetUp()
> +    {
> +        assertEquals( "second", System.getProperty( "phaseName" ) );
> +    }
> +
> +}
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/FourthTest.java
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/SecondTest.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/SecondTest.java?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/SecondTest.java
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/SecondTest.java
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,17 @@
> +package defaultConfiguration;
> +
> +import junit.extensions.TestSetup;
> +import junit.framework.Test;
> +import junit.framework.TestCase;
> +import junit.framework.TestSuite;
> +
> +public class SecondTest
> +    extends TestCase
> +{
> +
> +    public void testSetUp()
> +    {
> +        assertEquals( "second", System.getProperty( "phaseName" ) );
> +    }
> +
> +}
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/SecondTest.java
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Added:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/ThirdTest.java
> URL:
> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/ThirdTest.java?rev=1232972&view=auto
>
> ==============================================================================
> ---
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/ThirdTest.java
> (added)
> +++
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/ThirdTest.java
> Wed Jan 18 17:53:39 2012
> @@ -0,0 +1,17 @@
> +package defaultConfiguration;
> +
> +import junit.extensions.TestSetup;
> +import junit.framework.Test;
> +import junit.framework.TestCase;
> +import junit.framework.TestSuite;
> +
> +public class ThirdTest
> +    extends TestCase
> +{
> +
> +    public void testSetUp()
> +    {
> +        assertEquals( "first", System.getProperty( "phaseName" ) );
> +    }
> +
> +}
>
> Propchange:
> maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-806-specifiedTests-single/src/test/java/defaultConfiguration/ThirdTest.java
>
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message