Skip to content

Commit 9446e45

Browse files
committed
initial mods
1 parent 9edaa2d commit 9446e45

File tree

7 files changed

+162
-0
lines changed

7 files changed

+162
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sample stuff
2+
target/
3+
.testresult.links/
4+
testresult.*

.testspace.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<schema version="1.0" manual="0">
3+
<root>
4+
<attributes>
5+
<![CDATA[INSTALL_DIR = $PWD
6+
RESULTS_DIR = ${INSTALL_DIR}/target/surefire-reports/junitreports
7+
COVERAGE_DIR = ${INSTALL_DIR}/target/site/cobertura]]>
8+
</attributes>
9+
<suite name="Compile" state="1" id=".sh" description="**Compiling** Classes">
10+
<attributes>
11+
<![CDATA[
12+
mvn clean compile]]>
13+
</attributes>
14+
</suite>
15+
<suite name="Tests" state="1" id=".sh" description="run **all** of the tests">
16+
<attributes>
17+
<![CDATA[mvn cobertura:cobertura -Dcobertura.report.format=xml
18+
echo "${RESULTS_DIR}/TEST-*.xml{src/test/java/com/testspace/java}" > ${self.result}]]>
19+
</attributes>
20+
</suite>
21+
<suite name="Coverage" state="1" id=".sh" description="Code coverage based on latest run. Review the ==Reports== tab for historical tracking">
22+
<attributes>
23+
<![CDATA[mv "$COVERAGE_DIR/coverage.xml" ${self.result}]]>
24+
</attributes>
25+
</suite>
26+
</root>
27+
</schema>

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language:
2+
- java
3+
4+
before_install:
5+
# Install Testspace Runner
6+
- ./testspace_install.sh
7+
8+
script:
9+
- mvn clean compile
10+
- mvn cobertura:cobertura -Dcobertura.report.format=xml
11+
12+
# Publish Test Results along with Coverage
13+
- export PATH="${HOME}/testspace:${PATH}"
14+
# Testspace credentials: "[email protected]/myproject/myspace
15+
- testspace config url ${TESTSPACE_USER_TOKEN}:@${TESTSPACE_URL}
16+
- testspace publish [Tests]./target/surefire-reports/junitreports/TEST*.xml{src/test/java/com/testspace/java} ./target/site/cobertura/coverage.xml

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[![Testspace](http://www.testspace.com/public/img/testspace_logo.png)](http://www.testspace.com)
2+
***
3+
4+
## Java/TestNG sample for demonstrating Testspace
5+
6+
Sample demonstrates techniques for using Testspace with Java code and the [TestNG](http://testng.org/).
7+
8+
***
9+
10+
[![Build Status](https://travis-ci.org/testspace-samples/java.testng.svg?branch=master)](https://travis-ci.org/testspace-samples/java.testng)
11+
[![Space Health](https://samples.testspace.com/projects/84/spaces/285/badge)](https://samples.testspace.com/projects/84/spaces/285 "Test Cases")
12+
[![Space Metric](https://samples.testspace.com/projects/84/spaces/285/metrics/179/badge)](https://samples.testspace.com/projects/84/spaces/285/metrics#metric-179 "Line/Statement Coverage")
13+
14+
***
15+
16+
Build examples:
17+
18+
<pre>
19+
mvn clean compile
20+
mvn cobertura:cobertura -Dcobertura.report.format=xml
21+
</pre>
22+
23+
Publish **`test results`** along with **`code coverage`**
24+
25+
<pre>
26+
testspace publish ./target/surefire-reports/junitreports/TEST*.xml ./target/site/cobertura/coverage.xml results
27+
</pre>
28+
29+
Checkout the [Space](https://samples.testspace.com/projects/java/spaces/testng).
30+
31+
***
32+
33+
To fork this example using Travis requires:
34+
- Create an account at www.testspace.com
35+
- Travis Environment Variables:
36+
- `TESTSPACE_USER_TOKEN` set to the `value` defined as your [Access token](http://help.testspace.com/using-your-organization:user-settings).
37+
- `TESTSPACE_URL` set to `my-org-name.testspace.com/my-project/my-space`. Refer [here](http://help.testspace.com/reference:runner-reference#config) for more details. This example uses `samples.testspace.com/cpp/googletest`.

pom.xml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.testspace.java</groupId>
5+
<artifactId>testng</artifactId>
6+
<packaging>jar</packaging>
7+
<version>1.0-SNAPSHOT</version>
8+
<name>testng</name>
9+
<url>http://maven.apache.org</url>
10+
<dependencies>
11+
<dependency>
12+
<groupId>org.testng</groupId>
13+
<artifactId>testng</artifactId>
14+
<version>6.1.1</version>
15+
<scope>test</scope>
16+
</dependency>
17+
</dependencies>
18+
<reporting>
19+
<plugins>
20+
<!-- integrate maven-cobertura-plugin to project site -->
21+
<plugin>
22+
<groupId>org.codehaus.mojo</groupId>
23+
<artifactId>cobertura-maven-plugin</artifactId>
24+
<version>2.6</version>
25+
<configuration>
26+
<formats>
27+
<format>html</format>
28+
<format>xml</format>
29+
</formats>
30+
</configuration>
31+
</plugin>
32+
</plugins>
33+
</reporting>
34+
<build>
35+
<pluginManagement>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-compiler-plugin</artifactId>
40+
<configuration>
41+
<source>1.7</source>
42+
<target>1.7</target>
43+
<showDeprecation>true</showDeprecation>
44+
<showWarnings>true</showWarnings>
45+
<fork>true</fork>
46+
</configuration>
47+
</plugin>
48+
</plugins>
49+
</pluginManagement>
50+
</build>
51+
</project>

shippable.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: java
2+
3+
env:
4+
global:
5+
- secure: VpGJen1yjMHUkveYiN893EH8kdlFoZzwAuXprcPBgrgvvzff6rTdLtNOK4ao4h+wdpsJpL0giXT8rslmtMYW4k5Iv822LRZxSP+prZl63rXDhq0WGzNhk46Ls1CNDxNsStJJWCvGlJAMHSsgo7GXVvM4yKx6vUTfUsrYLl4SKt9ZDD9zF5qlgbq4s+hm28A4KcyfC0NCmDt0tnM99ygf00Lo568+56+KUr+fD1shejmjasC+jas/kxqTmE/8RoOF5LIVMV/4GizxLfEiX7BF70FlgMV+v+RkvYxubJV0gemrOie7ugairkKnxq+iq986bKs2sPaBB+iqfUDa+nhCoQ==
6+
7+
before_script:
8+
- ./testspace_install.sh
9+
- mkdir -p shippable/codecoverage
10+
- mkdir -p shippable/testresults
11+
12+
script:
13+
- export PATH="${HOME}/testspace:${PATH}"
14+
- testspace config url $TESTSPACE_TOKEN
15+
- testspace import .testspace.xml
16+
- testspace run
17+
18+
- cp target/surefire-reports/junitreports/TEST*.xml shippable/testresults
19+
- cp target/site/cobertura/coverage.xml shippable/codecoverage

testspace_install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
# Install the Testspace runner
4+
mkdir ${HOME}/testspace
5+
wget -N -P . https://testspace-runner.s3.amazonaws.com/testspace-linux-latest.tgz
6+
tar -zxvf testspace-linux-latest.tgz -C ${HOME}/testspace
7+
rm testspace-linux-latest.tgz
8+
# export PATH=${HOME}/testspace:${PATH}

0 commit comments

Comments
 (0)