How to convert xml to html using allure report framework - allure

Im using allure reporting with maven and testng
after test running I have xml.file with report result, can anyone explain me flow to convert it to html?

Add below in case you do not have this in your pom.xml.
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>${allure.maven.version}</version>
<configuration>
<resultsPattern>${allure.results_pattern}</resultsPattern>
</configuration>
</plugin>
</plugins>
</reporting>
Then, re-run your test and run this command,
mvn site -Dallure.results_pattern=allure-results
This will create a site folder under which you should get allure-maven-plugin.html. This is what you want i think.

Related

How to run specified testng.xml file in maven out of a set?

I am creating a batch multiple test suites for a project. I have a regression test and a smoke test. I need to call it from the batch file, so regression I need to run after a release but smoke every day. However when I run
cd %projectLocation%
call mvn clean test -DsuiteXmlFile=smokeTestRunner.xml
in a file it still jumps to the regression test first. Here is my surefire plugin config:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<!-- TestNG suite XML files -->
<suiteXmlFile>regressionTestRunner.xml</suiteXmlFile>
<suiteXmlFile>smokeTestRunner.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
How do I make it run only smoke test or regression test separately? Both runner.xml files and pom.xml are in the same directory
Try this in pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>{suite}.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
And then run in terminal:
mvn clean test -Dsuite=smokeTestRunner
or
mvn clean test -Dsuite=regressionTestRunner

Allure reports folder created but no report seen in the folder

I have added the required dependencies in my POM.xml and also added the required plugin in the runner class. But when I run, I see that the allure reports folder is created and it has a json file. I don't see the html report generated. Am I missing something here? My plugin code is below.
plugin = { "pretty", "html:target/cucumber-html-reports", "io.qameta.allure.cucumberjvm.AllureCucumberJvm",
"json:target/cucumber-html-reports/cucumber.json"}
Ideally there should be a html report which is generated.
Below is the part of pom.xml for the surefire reports
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumberjvm.AllureCucumberJvm"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>

How to set version when deploying gae java?

Since Intellij Idea IDE gae deployment plugin does not work, I have to use mvn appengine:update. It always deploy to version 1, ignoring version in appengine-web.xml.
How to set version with mvn appengine:update deployment?
Another way is, don't add anything on the app engine plugin as it is hard to changes each time the pom.xml better pass the version information from the command line, like this
mvn clean package appengine:deploy -Dapp.deploy.version=your-version-here
reference document here
You can set it via a Maven property:
<properties>
<appengine.appId>my-application-id</appengine.appId>
<appengine.version>my-application-version</appengine.version>
</properties>
PS: I'm also setting the applicationId here, you don't necessarily need that.
Add the following into the plugins section in the project pom.xml file:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.2.0</version>
<configuration>
<deploy.projectId>java</deploy.projectId>
<deploy.version>1</deploy.version>
</configuration>
</plugin>
Set the version in plugin property
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<version>2</version>
</configuration>
</plugin>

Maven Cobertura plugin not generating coverage.xml

I am trying to generate a coverage.xml so that I can reference it in Cobertura plugin of Hudson, but the file is not being created.
I've added the following to my POM
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
</reporting>
After running mvn cobertura:cobertura, the HTML site is generated as expected at **\target\site\cobertura, but coverage.xml is nowhere to be found. What am I missing/misunderstanding?
I am running Maven 3.0.3
Add below lines to your application Goals:(configure section of the application in jenkins)
cobertura:cobertura -Dcobertura.report.format=xml
pom.xml changes:
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
I put the plugin in the build section and it works:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
</build>
The reporting section and its differences to the plugin section are described here. I don't know if this is a maven [3.0.4] or cobertura-plugin issue.
I'm still quite a novice with the connections between Maven Plugins and Hudson and it's plugins - so this isn't an intelligent answer by any means, but help on Google is very few and far between for this issue - so hopefully it helps someone in the future.
After spending a few more hours of tinkering with settings, I've found that the coverage.xml simply doesn't seem to be built locally.
This is the combination that got it working:
I had changed my version to 2.2 in my POM (I was getting resource
not found errors from Apache with 2.5.1)
Added cobertura:cobertura in my Hudson goal
Set the Cobertura coverage pattern to the
recommended **/target/site/cobertura/coverage.xml
My objective was to get Cobertura to run duing mvn test with no additional command line parameters. Here's the magic XML that did the trick for me, with both the HTML and XML being generated in /target/site/cobertura.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>cobertura</id>
<phase>test</phase>
<goals>
<goal>cobertura</goal>
</goals>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I had the same issue but it's resolved right now:
Just add -Dcobertura.report.format=xml after your maven command. It should work
I have the same issue using 2.6 of the plugin.
I found that when I specify both types, I only got html.
<formats>
<format>html</format>
<format>xml</format>
</formats>
But when I specify only xml, I get an xml report.
<formats>
<format>xml</format>
</formats>
This is probably a bug in the plugin.
Another user suggested creating two executions. I tried that with no success (meaning I got html, but not xml).
Update your POM file as
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
This worked out for me: Probable reason it contanis the latest version of cobertura-maven-plugin (2.7)
The are two ways to integrate Cobertura into Maven.
Put Cobertura into the build section of the pom file, then you have to execute mvn clean cobertura:cobertura to generate the reports. If you have XML and HTML configured, then you get both reports.
Put Cobertura into the reporting section of the pom file, then you have to execute mvn clean site to generate the reports. If you have XML and HTML configured, then you get both reports. Additionally you get a generated site (open target/site/index.html) with all reports integrated e.g. Coberture, Checkstyle, ...

maven-pmd-plugin uses only the bundled rulesets

I am using the maven-pmd-plugin on my project and this is how I have configured it
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.6</version>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>UTF-8</sourceEncoding>
<minimumTokens>100</minimumTokens>
<targetJdk>${targetJdk}</targetJdk>
<rulesets>
<ruleset>${maven.pmd.rulesetfiles}</ruleset>
</rulesets>
</configuration>
</plugin>
</plugins>
</reporting>
Here are the properties used in the above configuration
<properties>
<spring.version>3.0.6.RELEASE</spring.version>
<basedir>C:\Users\Q4\workspace\project</basedir>
<maven.pmd.rulesetfiles>${basedir}\pmdRuleset.xml</maven.pmd.rulesetfiles>
<targetJdk>1.5</targetJdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
The problem is when I run mvn pmd:check, it gives me 8 violations -- only from the basic, unusedcode and imports. It simply doesn't use all the rules that I have listed in the custom ruleset file. I have even tried using the logging-java.xml and strings.xml directly in the ruleset without using the custom ruleset file and it still doesn't work.
When i run mvn pmd:pmd, i get a BUILD SUCCESS but the errors still show up in my target folder. Why do I get a build success here?
I solved this by simply adding the plugins in the build section along with the ones in the reporting section.
Somehow it needed to be in the as well to be able to run all the rulesets. Earlier I was under the impression that we put plugins in the build only if we want to run them during the build and deploy phase.

Resources