User Tools



Java

The following sections provide information on using Testspace with popular Java test frameworks and tools.

To push the collected result files to Testspace simply use the following client command line:

testspace static-analysis-results test-results code-coverage-results credentials@org-name.testspace.com/project-name/space-name 

where:

For more information on pushing results refer to the Collecting Data article.


Test Frameworks

JUnit

JUnit is a simple framework to write repeatable tests. It's an instance of the xUnit architecture for unit testing frameworks.

Note: The description that follows assumes that you are using Apache Maven with the Surefire Plugin to run your JUnit tests1).

Testspace accepts JUnit XML formatted JUnit Test results. Here is an example of how to produce such:

mvn surefire:test

In the Testspace client command line reference ./target/surefire-reports/TEST*.xml2) as "test-results" files.

TestNG

TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use.

Note: The description that follows assumes that you are using Apache Maven with the Surefire Plugin to run your TestNG tests3).

Testspace accepts JUnit XML formatted TestNG Test results. Here is an example of how to produce such:

mvn surefire:test

In the Testspace client command line reference ./target/surefire-reports/junitreports/TEST*.xml4) as "test-results" files.


Code Coverage Tools

Cobertura

Cobertura is a code coverage utility for Java.

Testspace accepts Cobertura XML formatted results. Please consult Cobertura's documentation on how to create in your environment. For example using Apache Maven with the Cobertura Plugin to produce such simply run:

mvn cobertura:cobertura

In the Testspace client command line reference ./target/site/cobertura/coverage.xml5) as "code-coverage-results" file.

JaCoCo

JaCoCo is a code coverage library for Java.

Testspace accepts JaCoCo XML formatted results. Please consult the JaCoCo's documentation on how to create in your environment. For example using Apache Maven with the JaCoCo Plugin to produce such simply run:

mvn jacoco:report

In the Testspace client command line reference ./target/site/jacoco/jacoco.xml6) as "code-coverage-results" file.

Atlassian Clover

Atlassian Clover provides Java and Groovy code coverage for software testing.

Testspace accepts Clover XML formatted results. Please consult the Clover's documentation on how to create in your environment. For example using Apache Maven with the Clover Plugin to produce such simply run:

mvn clover:clover

In the Testspace client command line reference ./target/site/clover/clover.xml7) as "code-coverage-results" file.


Static Analysis Tools

Compiler

Any compiler relies on static analysis of the source code during compilation to generate its errors and warnings.

Testspace accepts GCC/Emacs formatted build output logs. Simply write your build output to a file, e.g. build.log.

In the Testspace client command line reference build.log{lint} as "static-analysis-results" file.

Android lint

Android lint is a code scanning tool that can help identifying and correcting problems with the structural quality of Java code.

Testspace accepts Android lint XML formatted results. Here is an example of how to produce such:

lint --fullpath --xml analysis.xml /path/to/project

In the Testspace client command line reference analysis.xml as "static-analysis-results" file.

Checkstyle

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard.

Testspace accepts Checkstyle XML formatted results. Here is an example of how to produce such:

java -jar checkstyle-7.4-all.jar -f xml -o analysis.xml /path/to/source

In the Testspace client command line reference analysis.xml as "static-analysis-results" file.

PMD

PMD is a source code analyzer for Java.

Testspace accepts PMD XML formatted results. Here is an example of how to produce such:

pmd/bin/run.sh -format xml -reportfile analysis.xml -dir /path/to/source

In the Testspace client command line reference analysis.xml as "static-analysis-results" file.

1) If you aren't already using JUnit with Maven, please see this article which describes the needed configuration.
2) Maven Surefire plugin puts the generated XML report files at ./target/surefire-reports
3) If you aren't already using TestNG with Maven, please see this article which describes the needed configuration.
4) Maven Surefire plugin puts the generated XML report files at ./target/surefire-reports/junitreports
5) Maven Cobertura Plugin puts the generated XML report files at ${project.reporting.outputDirectory}/cobertura
6) Maven JaCoCo Plugin puts the generated XML report files at ${project.reporting.outputDirectory}/jacoco
7) Maven Clover Plugin puts the generated XML report files at ${project.reporting.outputDirectory}/clover

Page Tools