You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Christophe DENEUX <ch...@capgemini.com> on 2006/07/24 14:16:50 UTC

Functional Tests and maven-surefire-report-plugin

Hi all,

I'm trying to use maven-surefire-report-plugin to have a status on my 
functional tests in the maven generated website.

I think that i have used a standard way to implement functional tests:
    - my functional tests are a module of my project, that is packaged 
as POM (<packaging>pom</packaging>).
    - I have defined sources directories as src/it/java and 
src/it/resources,
    - I have redefined execution for maven-compiler-plugin, 
maven-resources-plugin, maven-surefire-plugin.

When I launch "mvn clean integration-test site site:deploy", the 
surefire report is not generated during site generation, but my 
functional tests are executed.
Here after, the POM of my functional module and execution traces.

Any idea ?

Thanks,
Christophe DENEUX


------------------------------------------------------------------

<?xml version="1.0"?>

<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">
    <parent>
        <groupId>...</groupId>
        <artifactId>...</artifactId>
        <version>...</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>functional-tests</artifactId>
    <name>...</name>
    <packaging>pom</packaging>
   
    <dependencies>
        ...
    </dependencies>
   
    <build>
        <testSourceDirectory>src/it/java</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>${basedir}/src/it/resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
           
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>testResources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
           
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
   
    <reporting>
        <plugins>
            ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
            </plugin>
            ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>
</project>

---------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\Documents and Settings\cdeneux\Mes 
documents\Alc...
[INFO] Deleting directory C:\Documents and Settings\cdeneux\Mes 
documents\Alc...
[INFO] Deleting directory C:\Documents and Settings\cdeneux\Mes 
documents\Alc...
[INFO] [resources:testResources {execution: default}]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile {execution: default}]
Compiling 1 source file to C:\Documents and Settings\cdeneux\Mes 
documents\Al...
[INFO] [site:attach-descriptor]
[INFO] [surefire:test {execution: default}]
[INFO] Surefire report directory: C:\Documents and Settings\cdeneux\Mes 
docum...

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
<<......>>
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 14.985 
sec <<< FAILURE!

Results :
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[ERROR] There are test failures.
[INFO] Preparing surefire-report:report
[INFO] [resources:testResources {execution: default}]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile {execution: default}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [site:site]
[WARNING] Unable to load parent project from repository: Could not find 
the model file '
[INFO] Generate "Continuous Integration" report.
[INFO] Generate "Dependencies" report.
[INFO] Generate "Dependency Convergence" report.
[INFO] Generate "Issue Tracking" report.





This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


Re: Functional Tests and maven-surefire-report-plugin

Posted by Luis Perea <lp...@telmex.com>.
Hi,

I've got the same problem, when I execute my functional test's with "mvn
install" everything is OK, my tests run fine, but with "mvn site" neither
the tests nor the surefire report are generated.

Have you found any solution for this problem? 





Christophe DENEUX wrote:
> 
> 
> Hi friends,
> 
> It seems that the maven-surefire-report-plugin generates the report only 
> if the "language" of the "packaging" is "java" (see in source code: 
> SurefireReportMojo.canGenerateReport).
> 
> As described in "Introduction to the Build Lifecycle" 
> (http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html), 
> I try to create a new packaging (<packaging>it-java</packaging>) as a 
> build extension:
>     - to map executions of maven-compiler-plugin, 
> maven-resources-plugin, maven-surefire-plugin on the right phases,
>     - to define the language ("java").
> 
> I have updated the POM of my functional tests modules to change the 
> packagin and add the extension.
> 
> But the maven-surefire-report-plugin does not recognize the language of 
> my new packaging. The executions of maven-compiler-plugin, 
> maven-resources-plugin, maven-surefire-plugin are fine.
> 
> Where is my mistake ?
> 
> My extension is only composed of the source file 
> META-INF/plexus/components.xml:
> <component-set>
>   <components>
>     <component>
>       <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
>       <role-hint>it-java</role-hint>
>       
> <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
>       <configuration>
>         <type>it-java</type>
>         <language>java</language>
>       </configuration>
>     </component>
>     <component>
>       <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
>       <role-hint>it-java</role-hint>
>       
> <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
>       <configuration>
>         <phases>
>           
> <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
>           
> <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
>           
> <integration-test>org.apache.maven.plugins:maven-surefire-plugin:test</integration-test>
>         </phases>
>       </configuration>
>     </component>
>   </components>
> </component-set>
> 
> 
> Thanks for your help.
> 
> ____________________________________________________________________________
> 
> Christophe DENEUX / Capgemini Sud / Méditerranée
> Technical Leader
> Tel: + 33 4 93 72 43 74 / www.capgemini.com
> Fax: + 33 4 93 21 02 95
> Porte de l'Arénas - Entrée B / 455 Promenade des Anglais / 06200 Nice
> 
> Join the Collaborative Business Experience
> ____________________________________________________________________________
> 
> 
> 
> Christophe DENEUX a écrit :
>>
>> Hi all,
>>
>> I'm trying to use maven-surefire-report-plugin to have a status on my 
>> functional tests in the maven generated website.
>>
>> I think that i have used a standard way to implement functional tests:
>>    - my functional tests are a module of my project, that is packaged 
>> as POM (<packaging>pom</packaging>).
>>    - I have defined sources directories as src/it/java and 
>> src/it/resources,
>>    - I have redefined execution for maven-compiler-plugin, 
>> maven-resources-plugin, maven-surefire-plugin.
>>
>> When I launch "mvn clean integration-test site site:deploy", the 
>> surefire report is not generated during site generation, but my 
>> functional tests are executed.
>> Here after, the POM of my functional module and execution traces.
>>
>> Any idea ?
>>
>> Thanks,
>> Christophe DENEUX
>>
>>
>> ------------------------------------------------------------------
>>
>> <?xml version="1.0"?>
>>
>> <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">
>>    <parent>
>>        <groupId>...</groupId>
>>        <artifactId>...</artifactId>
>>        <version>...</version>
>>    </parent>
>>    <modelVersion>4.0.0</modelVersion>
>>    <artifactId>functional-tests</artifactId>
>>    <name>...</name>
>>    <packaging>pom</packaging>
>>      <dependencies>
>>        ...
>>    </dependencies>
>>      <build>
>>        <testSourceDirectory>src/it/java</testSourceDirectory>
>>        <testResources>
>>            <testResource>
>>                <directory>${basedir}/src/it/resources</directory>
>>            </testResource>
>>        </testResources>
>>        <plugins>
>>            <plugin>
>>                <groupId>org.apache.maven.plugins</groupId>
>>                <artifactId>maven-compiler-plugin</artifactId>
>>                <executions>
>>                    <execution>
>>                        <goals>
>>                            <goal>testCompile</goal>
>>                        </goals>
>>                    </execution>
>>                </executions>
>>            </plugin>
>>                      <plugin>
>>                <groupId>org.apache.maven.plugins</groupId>
>>                <artifactId>maven-resources-plugin</artifactId>
>>                <executions>
>>                    <execution>
>>                        <goals>
>>                            <goal>testResources</goal>
>>                        </goals>
>>                    </execution>
>>                </executions>
>>            </plugin>
>>                      <plugin>
>>                <groupId>org.apache.maven.plugins</groupId>
>>                <artifactId>maven-surefire-plugin</artifactId>
>>                <configuration>
>>                    <testFailureIgnore>true</testFailureIgnore>
>>                </configuration>
>>                <executions>
>>                    <execution>
>>                        <phase>integration-test</phase>
>>                        <goals>
>>                            <goal>test</goal>
>>                        </goals>
>>                    </execution>
>>                </executions>
>>            </plugin>
>>        </plugins>
>>    </build>
>>      <reporting>
>>        <plugins>
>>            ...
>>            <plugin>
>>                <groupId>org.apache.maven.plugins</groupId>
>>                <artifactId>maven-surefire-report-plugin</artifactId>
>>            </plugin>
>>            ...
>>            <plugin>
>>                <groupId>org.apache.maven.plugins</groupId>
>>                <artifactId>maven-project-info-reports-plugin</artifactId>
>>            </plugin>
>>        </plugins>
>>    </reporting>
>> </project>
>>
>> ---------------------------------------------------
>> [INFO] [clean:clean]
>> [INFO] Deleting directory C:\Documents and Settings\cdeneux\Mes 
>> documents\Alc...
>> [INFO] Deleting directory C:\Documents and Settings\cdeneux\Mes 
>> documents\Alc...
>> [INFO] Deleting directory C:\Documents and Settings\cdeneux\Mes 
>> documents\Alc...
>> [INFO] [resources:testResources {execution: default}]
>> [INFO] Using default encoding to copy filtered resources.
>> [INFO] [compiler:testCompile {execution: default}]
>> Compiling 1 source file to C:\Documents and Settings\cdeneux\Mes 
>> documents\Al...
>> [INFO] [site:attach-descriptor]
>> [INFO] [surefire:test {execution: default}]
>> [INFO] Surefire report directory: C:\Documents and 
>> Settings\cdeneux\Mes docum...
>>
>> -------------------------------------------------------
>> T E S T S
>> -------------------------------------------------------
>> <<......>>
>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 14.985 
>> sec <<< FAILURE!
>>
>> Results :
>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
>>
>> [ERROR] There are test failures.
>> [INFO] Preparing surefire-report:report
>> [INFO] [resources:testResources {execution: default}]
>> [INFO] Using default encoding to copy filtered resources.
>> [INFO] [compiler:testCompile {execution: default}]
>> [INFO] Nothing to compile - all classes are up to date
>> [INFO] [site:site]
>> [WARNING] Unable to load parent project from repository: Could not 
>> find the model file '
>> [INFO] Generate "Continuous Integration" report.
>> [INFO] Generate "Dependencies" report.
>> [INFO] Generate "Dependency Convergence" report.
>> [INFO] Generate "Issue Tracking" report.
>>
>>
>>
>>
>>
>> This message contains information that may be privileged or 
>> confidential and is the property of the Capgemini Group. It is 
>> intended only for the person to whom it is addressed. If you are not 
>> the intended recipient,  you are not authorized to read, print, 
>> retain, copy, disseminate,  distribute, or use this message or any 
>> part thereof. If you receive this  message in error, please notify the 
>> sender immediately and delete all  copies of this message.
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient, 
> you are not authorized to read, print, retain, copy, disseminate, 
> distribute, or use this message or any part thereof. If you receive this 
> message in error, please notify the sender immediately and delete all 
> copies of this message.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

-- 
View this message in context: http://www.nabble.com/Functional-Tests-and-maven-surefire-report-plugin-tf1991883.html#a6865596
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Functional Tests and maven-surefire-report-plugin

Posted by Christophe DENEUX <ch...@capgemini.com>.
Hi friends,

It seems that the maven-surefire-report-plugin generates the report only 
if the "language" of the "packaging" is "java" (see in source code: 
SurefireReportMojo.canGenerateReport).

As described in "Introduction to the Build Lifecycle" 
(http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html), 
I try to create a new packaging (<packaging>it-java</packaging>) as a 
build extension:
    - to map executions of maven-compiler-plugin, 
maven-resources-plugin, maven-surefire-plugin on the right phases,
    - to define the language ("java").

I have updated the POM of my functional tests modules to change the 
packagin and add the extension.

But the maven-surefire-report-plugin does not recognize the language of 
my new packaging. The executions of maven-compiler-plugin, 
maven-resources-plugin, maven-surefire-plugin are fine.

Where is my mistake ?

My extension is only composed of the source file 
META-INF/plexus/components.xml:
<component-set>
  <components>
    <component>
      <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
      <role-hint>it-java</role-hint>
      
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
      <configuration>
        <type>it-java</type>
        <language>java</language>
      </configuration>
    </component>
    <component>
      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
      <role-hint>it-java</role-hint>
      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
      <configuration>
        <phases>
          
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
          
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
          
<integration-test>org.apache.maven.plugins:maven-surefire-plugin:test</integration-test>
        </phases>
      </configuration>
    </component>
  </components>
</component-set>


Thanks for your help.

____________________________________________________________________________

Christophe DENEUX / Capgemini Sud / M�diterran�e
Technical Leader
Tel: + 33 4 93 72 43 74 / www.capgemini.com
Fax: + 33 4 93 21 02 95
Porte de l'Ar�nas - Entr�e B / 455 Promenade des Anglais / 06200 Nice

Join the Collaborative Business Experience
____________________________________________________________________________



Christophe DENEUX a �crit :
>
> Hi all,
>
> I'm trying to use maven-surefire-report-plugin to have a status on my 
> functional tests in the maven generated website.
>
> I think that i have used a standard way to implement functional tests:
>    - my functional tests are a module of my project, that is packaged 
> as POM (<packaging>pom</packaging>).
>    - I have defined sources directories as src/it/java and 
> src/it/resources,
>    - I have redefined execution for maven-compiler-plugin, 
> maven-resources-plugin, maven-surefire-plugin.
>
> When I launch "mvn clean integration-test site site:deploy", the 
> surefire report is not generated during site generation, but my 
> functional tests are executed.
> Here after, the POM of my functional module and execution traces.
>
> Any idea ?
>
> Thanks,
> Christophe DENEUX
>
>
> ------------------------------------------------------------------
>
> <?xml version="1.0"?>
>
> <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">
>    <parent>
>        <groupId>...</groupId>
>        <artifactId>...</artifactId>
>        <version>...</version>
>    </parent>
>    <modelVersion>4.0.0</modelVersion>
>    <artifactId>functional-tests</artifactId>
>    <name>...</name>
>    <packaging>pom</packaging>
>      <dependencies>
>        ...
>    </dependencies>
>      <build>
>        <testSourceDirectory>src/it/java</testSourceDirectory>
>        <testResources>
>            <testResource>
>                <directory>${basedir}/src/it/resources</directory>
>            </testResource>
>        </testResources>
>        <plugins>
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-compiler-plugin</artifactId>
>                <executions>
>                    <execution>
>                        <goals>
>                            <goal>testCompile</goal>
>                        </goals>
>                    </execution>
>                </executions>
>            </plugin>
>                      <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-resources-plugin</artifactId>
>                <executions>
>                    <execution>
>                        <goals>
>                            <goal>testResources</goal>
>                        </goals>
>                    </execution>
>                </executions>
>            </plugin>
>                      <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-surefire-plugin</artifactId>
>                <configuration>
>                    <testFailureIgnore>true</testFailureIgnore>
>                </configuration>
>                <executions>
>                    <execution>
>                        <phase>integration-test</phase>
>                        <goals>
>                            <goal>test</goal>
>                        </goals>
>                    </execution>
>                </executions>
>            </plugin>
>        </plugins>
>    </build>
>      <reporting>
>        <plugins>
>            ...
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-surefire-report-plugin</artifactId>
>            </plugin>
>            ...
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-project-info-reports-plugin</artifactId>
>            </plugin>
>        </plugins>
>    </reporting>
> </project>
>
> ---------------------------------------------------
> [INFO] [clean:clean]
> [INFO] Deleting directory C:\Documents and Settings\cdeneux\Mes 
> documents\Alc...
> [INFO] Deleting directory C:\Documents and Settings\cdeneux\Mes 
> documents\Alc...
> [INFO] Deleting directory C:\Documents and Settings\cdeneux\Mes 
> documents\Alc...
> [INFO] [resources:testResources {execution: default}]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:testCompile {execution: default}]
> Compiling 1 source file to C:\Documents and Settings\cdeneux\Mes 
> documents\Al...
> [INFO] [site:attach-descriptor]
> [INFO] [surefire:test {execution: default}]
> [INFO] Surefire report directory: C:\Documents and 
> Settings\cdeneux\Mes docum...
>
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> <<......>>
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 14.985 
> sec <<< FAILURE!
>
> Results :
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
>
> [ERROR] There are test failures.
> [INFO] Preparing surefire-report:report
> [INFO] [resources:testResources {execution: default}]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:testCompile {execution: default}]
> [INFO] Nothing to compile - all classes are up to date
> [INFO] [site:site]
> [WARNING] Unable to load parent project from repository: Could not 
> find the model file '
> [INFO] Generate "Continuous Integration" report.
> [INFO] Generate "Dependencies" report.
> [INFO] Generate "Dependency Convergence" report.
> [INFO] Generate "Issue Tracking" report.
>
>
>
>
>
> This message contains information that may be privileged or 
> confidential and is the property of the Capgemini Group. It is 
> intended only for the person to whom it is addressed. If you are not 
> the intended recipient,  you are not authorized to read, print, 
> retain, copy, disseminate,  distribute, or use this message or any 
> part thereof. If you receive this  message in error, please notify the 
> sender immediately and delete all  copies of this message.
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.