mvn serenity:aggregate runs 0 tests and index.html has 0 results however mvn clean verify works and gets results - rest-assured

We have Serenity Cucumber integrated with Maven for REST API automation project running with Junit. Whenever trying to execute the command mvn serenity:aggregate results on console shows "Build success' but with 0 requirements loaded and index.html has 0 results and generated under target/site/serenity. Whereas if run with the command mvn clean verify getting results under the same folder.
pom.xml file of plugin:
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>2.0.40</version>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>2.0.40</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>4.5.0</version>
<dependencies>
<dependency>
<groupId>com.googlecode.totallylazy</groupId>
<artifactId>totallylazy</artifactId>
<version>1.20</version>
<scope>system</scope>
<systemPath>${basedir}/externalMavenLibrary/totallylazy-1.20.jar</systemPath>
</dependency>
</dependencies>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>cucumber-jvm-example</projectName>
<outputDirectory>${basedir}/target/site/cucumber-pretty</outputDirectory>
<jsonFiles>
<param>**/*.json</param>
</jsonFiles>
<classificationFiles>
<param>**/*.properties</param>
</classificationFiles>
<cucumberOutput>${basedir}/target/cucumber.json</cucumberOutput>
<enableFlashCharts>true</enableFlashCharts>
<checkBuildResult>true</checkBuildResult>
<skippedFails>true</skippedFails>
</configuration>
</execution>
</executions>
</plugin>
Other versions in the pom.xml file:
serenity-cucumber: 1.9.35
serenity-rest-assured: 2.0.45
serenity-core: 2.0.45
serenity-junit: 2.2.1
serenity-maven-plugin: 2.0.40
Serenity.properties file:
serenity.project.name=Test
serenity.console.colors=true
serenity.reports.show.step.details=true
Since unable to get report after running mvn serenity:aggregate, missing graphs and other nice features.
Please guide.

Able to figure out the reason why the command was not working. in pom.xml file, after adding tags and while running the command by giving the report output path, I am able to get the Serenity reports as expected.
updates done:
serenity.test.root="com.projectname.backend.core"
serenity.reports.show.step.details=true
serenity.outputDirectory = target/site/reports
in pom.xml file: added tags configuration, and the tag has value in RunnerFile.java
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.maven.version}</version>
<configuration>
<tags>${tags}</tags>
</configuration>
Also, below dependency versions used:
<properties>
<serenity.version>2.2.1</serenity.version>
<serenity.cucumber.version>2.2.0</serenity.cucumber.version>
<serenity.maven.version>2.2.1</serenity.maven.version>
</properties>
Command used:
mvn serenity:aggregate -Dserenity.outputDirectory=C:\Users\projectname\target\site\reports

I encoutred this problem and my error was that I forgot to name scenario in the feature file. So check this part

Related

Maven(pom.xml) do not run a plugin during deploy/install phase

If I have a pom.xml with the following code:
<build>
<plugins>
<plugin>
<groupId>something</groupId>
<artifactId>XXX</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
...
</configuration>
</execution>
</executions>
</plugins>
</build>
When I run mvn clean package, I want to run that plugin(which actually runs).
but
If I run mvn clean deploy, given phase package is previous to phase deploy is gonna run either(which I don't want to).
Is there any way to not run this plugin during deploy?
By the way: I cannot modify the mvn command executed, I need to do this inside the pom.xml file
The only way that I know to selectively enable a plugin is through Maven profile:
<project ...>
...
<build>
...
</build>
<profiles>
<profile>
<id>someprofile</id>
<build>
<plugins>
<plugin>
<groupId>something</groupId>
<artifactId>XXX</artifactId>
...
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
You would then run mvn package -Psomeprofile to run the plugin, or mvn deploy to not run it.
There are additional ways to automatically activate a profile. You will have to read the docs to see if any of those apply to you.

Analyzed bundle 'dump' with 0 classes

In the current configuration, I am using a jacoco-agent in the tcpserver mode for web application deployed on the serve node. Also, using jacoco-maven plugin to generate dump and report from my local node. I am able to get the dump in my local node by task mvn jacoco:dump. But when trying to generate the report against dump file by task mvn jacoco:report, getting "Analyzed bundle 'dump' with 0 classes".
Pom.xml
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<configuration>
<address>*.*.*.*</address>
<destFile>/app/jacoco_agent/new.exec</destFile>
<port>7906</port>
<reset>true</reset>
<append>false</append>
</configuration>
<executions>
<execution>
<phase>post-integration-test</phase>
<goals>
<goal>dump</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>/app/jacoco_agent/new.exec</dataFile>
<outputDirectory>/app/jacoco_agent/jacoco-ut</outputDirectory>
<includes>/target/classes</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
How can I generate a report by using jacoco-maven plugin?
Successfully able to generate a report by jacococli.jar.
java -jar ~/Downloads/jacoco-0.7.10-20171007.201717-57/lib/jacococli.jar report /app/jacoco_agent/new.exec --classfiles /target/classes --html report
Please help me to understand what's wrong, I am doing here with jacoco-maven plugin configuration?
Thanks

maven-dependency-plugin:unpack Error

I'm trying to extract some .exe files from a dependency jar file and put them under ${project.build.directory}/classes/.
But when I execute:
mvn clean compile dependency:unpack
I get:
Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:unpack (default-cli) on project simple: Either artifact or artifactItems is required -> [Help 1
I have verified that the dependencies are available in my local repository.
In my example pom below I've used junit as an example, but no matter which dependency I list, I get the same error.
pom.xml:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/classes/externaltools</outputDirectory>
<includes>**/*.txt</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
The issue is due to you cannot use mvn clean compile dependency:unpack and <executions> tags together.
In documentation Maven Depdendency Plugin at the bottom part of the page you can read:
If you intend to configure this mojo for execution on the command line using: mvn dependency:unpack you must not put the configuration inside the executions tag. Your configuration should look like this:
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<configuration>
<artifactItems>
<artifactItem>
<groupId>[ groupId ]</groupId>
<artifactId>[ artifactId ]</artifactId>
<version>[ version ]</version>
<type>[ packaging ]</type>
<classifier> [classifier - optional] </classifier>
<overWrite>[ true or false ]</overWrite>
<outputDirectory>[ output directory ]</outputDirectory>
<destFileName>[ filename ]</destFileName>
<includes>[ comma separated list of file filters ]</includes>
<excludes>[ comma separated list of file filters ]</excludes>
</artifactItem>
</artifactItems>
<!-- other configurations here -->
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
I have tried removing the <execution> tags and works perfectly!

Problems building ANTLR v4 from source using ant : [java] error(7): cannot find or open file: *.g

I was trying to build ANTLR version 4 from source, as I downloaded it from the official website, but I cannot do it using ant. I downloaded the antlr-3.5-complete-no-st3.jar to the /lib folder as build.xml says, but when I run ant it returns:
[mkdir] Created dir: /../antlr/antlr4-master/build/generated-sources/antlr3/org/antlr/v4/parse
[java] error(7): cannot find or open file: *.g
BUILD FAILED
/../antlr/antlr4-master/build.xml:108: The following error occurred while executing this line:
/../antlr/antlr4-master/build.xml:84: Java returned: 1
I am on a MacBook running OSX 10.8.2
Is there anything else I have to do in order to have a successful compilation using ant?
Thanks in advance,
Dimos
You need to use Maven to build ANTLR 4 from source.
Building ANTLR 4 with Maven
Above "Building ANTLR 4 with Maven" link seems not available. Please follow the below links for ANTLR 4 maven build. These helped me to achieve antlr 4 maven build.
https://groups.google.com/forum/#!msg/antlr-discussion/Vw4Ia__sgPk/nDS5Y9YSDGIJ
How do I get help on the antlr4-maven-plugin
My ANTLR-Maven Plugin is as below:-
<build>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.0</version>
<configuration>
<sourceDirectory>${basedir}/src/main/java/com/test</sourceDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.antlr</groupId>
<artifactId>
antlr4-maven-plugin
</artifactId>
<versionRange>
[4.0,)
</versionRange>
<goals>
<goal>antlr4</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.2.2</version>
</dependency>
</dependencies>

Maven: Overview for the values of Maven properties

I would like to find out the values of all Maven properties as they apply to some Maven project.
mvn help:system lists OS environment variables and JVM system properties, but no Maven properties.
mvn help:evaluate only works in an interactive mode, that means I have to type a single Maven property, (e.g. ${project.build.outputDirectory}) to get the value of that property.
I'm looking for a way get a full list of all Maven properties and their values.
As a workaround, add this to the <plugins> ... </plugins> section inside your project's pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echoproperties />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
Now execute mvn validate.
On the console, prefixed with [echoproperties], there will be the full list of system properties, including those set by Maven such as project.build.outputDirectory, basedir, and settings.localRepository.
the maven-help-plugin does what you want, just call it with -Dexpression=project.properties this will print the properties tag of the effective pom.
mvn help:evaluate -Dexpression=project.properties
Bonus Points when you just want the properties output and not the maven output
mvn help:evaluate -Dexpression=project.properties -q -DforceStdout
or with the explicit version because -DforceStdout works since version 3.1.0
mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.properties -q -DforceStdout
Not sure if helps, but I found this when trying to do the same thing:
mvn com.github.ekryd.echo-maven-plugin:echo-maven-plugin:echo -Decho.message='${project.build.testOutputDirectory}'
From here.
Adding the following to ${user.home}/.m2/settings.xml:
<pluginGroups>
<pluginGroup>com.github.ekryd.echo-maven-plugin</pluginGroup>
</pluginGroups>
the command can be shortened to:
mvn echo:echo -Decho.message='${project.build.testOutputDirectory}'
I don't know how to get them "officially", but here is a workaround. Add maven-antrun-plugin to your project and run mvn test -X. The plugin will show all properties passed to it from Maven. The list looks complete to me.
Actually project.build.outputDirectory is there but you need to execute in 'compile' phase, and NOT in 'validate'. I guess what properties are available also depends on the current phase for the executing goal of a particular plug-in, in this case 'maven-antrun-plugin'.
<!-- Ant Run Plugin for debugging pom.xml and calling ant tasks -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${ant.plugin.version}</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echoproperties/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
Had the same issue. Changed the timeout and maxheap in findbugs configuration through maven.
The below fixed it for me :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<maxHeap>2048</maxHeap>
<timeout>1800000</timeout>
</configuration>
</plugin>

Resources