maven sure-fire plugin report empty - maven

My requirement is to run multiple SOAPUI test cases via maven , automate it's build using jenkins and generate a report of the test results.
I have successfully done except the last part.
Now i want to generate a html report of results of all the test cases.
I used maven-surefire-report-plugin to do so.
I have followed this article
http://maven.apache.org/surefire/maven-surefire-report-plugin/usage.html
The test case is successful and report is generated successfully but there are no records in the report.
Am i missing something here? Is there any configuration parameter to set the source path for generating reports or something?
surefire report is generated in ${project.build.directory}/site folder.
Output files of the SOAPUI test case is generated at ${project.build.directory}/reports folder.
This is the pom.xml i have written
<?xml version="1.0" encoding="UTF-8"?> <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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>soapTest</groupId>
<artifactId>soapTest</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.1.2</version>
<configuration>
<projectFile>soapui-project.xml</projectFile>
<outputFolder>${project.build.directory}/test-classes</outputFolder>
<junitReport>true</junitReport>
<exportAll>true</exportAll>
<printReport>true</printReport>
<testSuite>Authenticate</testSuite>
</configuration>
<executions>
<execution>
<phase>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>
<version>2.7.2</version>
</plugin>
</plugins>
</reporting>

First line of the Maven Surefire Report Plugin Introduction says:
The Surefire Report Plugin parses the generated TEST-*.xml files under ${basedir}/target/surefire-reports ...
So if you change your soapui-maven-plugin to:
<outputFolder>${basedir}/target/surefire-reports</outputFolder>
That should work.
There are also additional instructions how to change the default location for the maven-surefire-report-plugin.

Sample pom.xml where reports are also being created with mvn site command.
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.smartbear.samples</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>smartbear-sweden-plugin-repository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.3.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>globalweather-soapui-project.xml</projectFile>
<junitReport>true</junitReport>
<outputFolder>${basedir}/target/surefire-reports</outputFolder>
<printReport>true</printReport>
<exportAll>true</exportAll>
<globalProperties>
<value>ENV=DEV</value>
</globalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.1</version>
<configuration>
<outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

Related

Missing assertion for type [JsonPath Match] error for a Soap UI project CI run

I have configured a CI run for a Soap UI project using Jenkins and Maven. My test steps have Json Path match assertions. Every time it runs, I get errors as
17:46:17,058 ERROR [TestAssertionRegistry] Missing assertion for type [JsonPath Match]
17:46:17,058 ERROR [TestAssertionRegistry] Missing assertion for type [JsonPath Match]
Due to the above reason, it skips all the JsonPath assertions associated with a test case step (though assertions like Valid HTTPS are validated successfully).
I am using soapui-maven-plugin:5.1.2 currently. After doing some research over internet, I found if a project is created in a version higher than the version the CI is using, the issue will persist. They recommended to re-write the project with the same version as the system, as explained at SoapUI Testrunner giving error about TestAssertionRegistry . I did but nothing changed.
I have tried soapui-maven-plugin:5.2.1 version but that didn't help either to solve the issue, instead it gave me another error and the build fails
EROR [SoapUI] An error occurred [The plugin 'C:\Users\xyz\.soapuios\plugins\SoapUI-Framework -v1.0.jar' has unsigned class files.
Please help me to fix the issue as the CI would be useless without assertions.
My pom file contains
<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>soapTest</groupId>
<artifactId>soapTest</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.1.2</version>
<configuration>
<projectFile>C:\Users\xyz\.jenkins\workspace\Soap-uiTest\Test.xml</projectFile>
<outputFolder>${basedir}/target/surefire-reports</outputFolder>
<junitReport>true</junitReport>
<exportAll>true</exportAll>
<printReport>true</printReport>
<testFailIgnore>true</testFailIgnore>
<!--testSuite>Negative test cases - JSON</testSuite-->
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<!-- Extended Maven antrun plugin -->
<!-- https://maven-antrun-extended-plugin.dev.java.net/ -->
<groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
<artifactId>maven-antrun-extended-plugin</artifactId>
<executions>
<execution>
<id>test-reports</id>
<phase>test</phase>
<configuration>
<tasks>
<junitreport todir="target/surefire-reports">
<fileset dir="target/surefire-reports">
<include name="**/*.xml"/>
</fileset>
<report format="noframes" todir="target/surefire-reports"/>
</junitreport>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.8.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
</plugin>
</plugins>
</reporting>
</project>

test-verify goal doesn't work with maven-soapui-extension-plugin

I see the following error when I try to run SoapUI Projects
Failed to execute goal com.github.redfish4ktc.soapui:maven-soapui-extension-plugin:4.6.4.2:test-verify (test-verify) on project TestProjects: SoapUI Test(s) failed: see logs and/or check the printReport (if necessary, set the option to true) -> [Help 1]
Child Pom File:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>Tutor</groupId>
<artifactId>TutorOnTest</artifactId>
<version>1.3</version>
<relativePath>..</relativePath>
</parent>
<artifactId>TestProjects</artifactId>
<name>TestProjects</name>
<pluginRepositories>
<pluginRepository>
<id>smartbear-sweden-plugin-repository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.github.redfish4ktc.soapui</groupId>
<artifactId>maven-soapui-extension-plugin</artifactId>
<version>4.6.4.2</version>
<dependencies>
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.1.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>run-Tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFiles>
<scan>
<baseDirectory>${basedir}</baseDirectory>
<includes>
<include>**/*-soapui-project.xml</include>
</includes>
</scan>
</projectFiles>
<projectProperties>
<value>url=http://localhost:8080</value>
</projectProperties>
<useOutputFolderPerProject>true</useOutputFolderPerProject>
<testFailIgnore>true</testFailIgnore>
</configuration>
</execution>
<execution>
<id>test-verify</id>
<phase>post-integration-test</phase>
<goals>
<goal>test-verify</goal>
</goals>
<configuration>
<printReport>true</printReport>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Can't bind maven-remote-resources-plugin to both bundle and process goals

I use the maven-remote-resources-plugin to get some resources from an artifact and also need to bundle some resources for use in another project.
I bind the maven-remote-resources-plugin to the bundle goal in the default section (not in a profile). And I bind the maven-remote-resources-plugin to the process goal in a profile.
My problem is that I don't get the shared resources when using the profile (I don't get the target\maven-shared-archive-resources folder).
If I remove the maven-remote-resources-plugin in the default section (the bundle binding) it works fine.
Any suggestions?
Below is my pom:
<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>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<name>my-app</name>
<dependencies>
<dependency>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app-common</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
<resourcesDirectory>${basedir}/src/test/resources</resourcesDirectory>
<includes>
<include>**/*.sql</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>create-test-data</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<testResources>
<testResource>
<directory>${basedir}/src/test/resources</directory>
</testResource>
<testResource>
<directory>${project.build.directory}/maven-shared-archive-resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<configuration>
<resourceBundles>
<resourceBundle>com.mycompany.app:my-app-common:1.0-SNAPSHOT:test-jar</resourceBundle>
</resourceBundles>
<attachToMain>false</attachToMain>
</configuration>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
The problem was that the property outputDirectory is defined for both the process and bundle goals and I redefined it in the bundle goal.

Building an RPM containing JDK dependency resolution

I'm building oracle jdk 1.6 into an rpm using maven and nexus from a zip file distribution of the jdk.
When done, the rpm refuses to install without the following:
[root#build]# rpm -ivh oracle-jdk-1.6.0_26-1.noarch.rpm
error: Failed dependencies:
libXt.so.6()(64bit) is needed by oracle-jdk-1.6.0_26-1.noarch
libodbc.so()(64bit) is needed by oracle-jdk-1.6.0_26-1.noarch
libodbcinst.so()(64bit) is needed by oracle-jdk-1.6.0_26-1.noarch
Fine. I'm guessing maven created this dependency. The jdk in it's native unzipped form works fine.
How can I configure my pom so that maven will not resolve these dependencies?
How would I configure my pom so that yum -y install will install the missing libraries?
I ask both, as I'm not sure which way I will sway.
Edit: my pom:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.oracle</groupId>
<artifactId>jdk</artifactId>
<version>1.6.0_26</version>
<packaging>pom</packaging>
<properties>
<unix.user>root</unix.user>
<rpm.friendly.name>oracle-jdk</rpm.friendly.name>
<rpm.install.basedir>/usr/java/jdk/1.6.0_26</rpm.install.basedir>
<sourcefile.unzip.dir>${project.build.directory}/jdk1.6.0_26</sourcefile.unzip.dir>
<yum.repo.host>localhost</yum.repo.host>
<yum.repo.path>/apps/httpd/yumrepo</yum.repo.path>
</properties>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>jdk</artifactId>
<version>1.6.0_26</version>
<type>tar.gz</type>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>ssh-repository</id>
<url>scpexe://${yum.repo.host}${yum.repo.path}</url>
</repository>
</distributionManagement>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-beta-6</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-3</version>
<executions>
<execution>
<id>generate-rpm</id>
<goals>
<goal>attached-rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<name>${rpm.friendly.name}</name>
<copyright>2014, JM</copyright>
<group>Application/Internet</group>
<packager>JM</packager>
<needarch>false</needarch>
<changelogFile>src/changelog</changelogFile>
<mappings>
<mapping>
<directory>${rpm.install.basedir}</directory>
<username>${unix.user}</username>
<groupname>${unix.user}</groupname>
<sources>
<source>
<location>${sourcefile.unzip.dir}</location>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>unpack</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>thirdparty</id>
<url>http://myrepo.com:8081/nexus/content/repositories/thirdparty</url>
</repository>
</repositories>
</project>
Basically i think its not a good idea to include other binaries (like java) in your package
i'd rather have dependency on them.
But sometimes you have to, for example customer already have Java on his machine but you want to run your own java version and thus provide it with your package.
To do that you can simply tell the maven plugin not to automatically add requires to those packages.
like this
<configuration>
......
<autoRequires>false</autoRequires>
</configuration>

maven: how to export packed sources with jar in "package" stage

I have a maven export script (that wasn't been written by me) and I would like to add sources coping as well.
the build script generates 2 outputs using the "maven-source-plugin":
.jar and -sources.jar and they are both exist in the same output folder one next to another.
so far only the jar is being copied, I want the script to place the -sources.jar file next to its jar file
the build pom:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mytest</groupId>
<artifactId>my-parent</artifactId>
<version>6.0.00-SNAPSHOT</version>
<packaging>pom</packaging>
<name>my-parent</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<assembly.format>dir</assembly.format>
<my.repository.rootUrl>http://maven.my.com</my.repository.rootUrl>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
.
.
.
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<target>1.6</target>
<source>1.6</source>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<modules>
.
.
.
</modules>
<repositories>
.
.
.
</repositories>
<distributionManagement>
.
.
.
</distributionManagement>
<pluginRepositories>
.
.
.
</pluginRepositories>
<organization>
<name>My</name>
</organization>
<profiles>
<profile>
<id>dist</id>
<modules>
<module>../my-assembly/my-runner</module>
</modules>
</profile>
</profiles>
</project>
the export pom:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.mytest</groupId>
<artifactId>my-parent</artifactId>
<version>6.0.00-SNAPSHOT</version>
<relativePath>../../my-parent</relativePath>
</parent>
<artifactId>my-runner</artifactId>
<dependencies>
.
.
.
</dependencies>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>single</goal>
</goals>
<id>create-runner</id>
<phase>package</phase>
<configuration>
<finalName>runner</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/runner.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
the runner file (referenced by the export pom):
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<formats>
<format>tar.gz</format>
<format>zip</format>
<format>dir</format>
</formats>
<id>runner</id>
<dependencySets>
.
.
.
<dependencySet>
<outputDirectory>lib</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension} </outputFileNameMapping>
<includes>
<include>org.mytest:*:jar</include>
<include>org.mytest.systemobjects:*:jar</include>
</includes>
<excludes>
<exclude>*:my-services-so:*</exclude>
<exclude>*:my-services-tests:*</exclude>
<exclude>*:my-runner:*</exclude>
</excludes>
</dependencySet>
</dependencySets>
<fileSets>
.
.
.
</fileSets>
</assembly>
thank you in advance!
From looking at MNG-1994 it seems that in each phase a child's plugins will execute before the parent's.
Your parent POM specifies the source plugin (which generates the sources JAR) in the package phase (this is the source plugin's default phase if not explicitly specified in the execution), but the assembly plugin, which generates the tar.gz, zip and uncompressed finished versions of your project, is run before the source plugin because the assembly plugin is declared in the child and the source plugin is declared in the parent.
A solution can be to change the phase the source plugin runs in to ensure it runs before the assembly plugin, something right before the package phase such as prepare-package will work. (full list of lifecycle phases is here)
In the parent, explicitly setting the phase to prepare-package will make it:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>prepare-package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
This should force the source plugin to execute before the assembly plugin and therefore the assembly plugin should pick up both attached JARs now.
Add another include element with the classifier sources:
<include>org.mytest:*:jar:sources</include>
See the documentation: http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_dependencySet

Resources