Skip to content

Commit 8776f26

Browse files
committed
canonical testnames in report
1 parent cd4345c commit 8776f26

File tree

4 files changed

+10
-100
lines changed

4 files changed

+10
-100
lines changed

README.md

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,40 @@ An application to provide support for executing tests in the specific order and
99
<dependency>
1010
<groupId>com.hackerrank.applications</groupId>
1111
<artifactId>junit-ordered-test-runner</artifactId>
12-
<version>1.0.1</version>
12+
<version>1.0.2</version>
1313
</dependency>
1414
```
1515

1616
- [Gradle Groovy DSL](gradle.org)
1717
```
18-
compile 'com.hackerrank.applications:junit-ordered-test-runner:1.0.1'
18+
compile 'com.hackerrank.applications:junit-ordered-test-runner:1.0.2'
1919
```
2020

2121
- [Gradle Kotlin DSL](github.com/gradle/kotlin-dsl)
2222
```
23-
compile(group = "com.hackerrank.applications", name = "junit-ordered-test-runner", version = "1.0.1")
23+
compile(group = "com.hackerrank.applications", name = "junit-ordered-test-runner", version = "1.0.2")
2424
```
2525

2626
- [Scala SBT](scala-sbt.org)
2727
```
28-
libraryDependencies += "com.hackerrank.applications" % "junit-ordered-test-runner" % "1.0.1"
28+
libraryDependencies += "com.hackerrank.applications" % "junit-ordered-test-runner" % "1.0.2"
2929
```
3030

3131
- [Apache Ivy](ant.apache.org/ivy/)
3232
```
33-
<dependency org="com.hackerrank.applications" name="junit-ordered-test-runner" rev="1.0.1" />
33+
<dependency org="com.hackerrank.applications" name="junit-ordered-test-runner" rev="1.0.2" />
3434
```
3535

3636
- [Groovy Grape](groovy-lang.org/grape.html)
3737
```
3838
@Grapes(
39-
@Grab(group='com.hackerrank.applications', module='junit-ordered-test-runner', version='1.0.1')
39+
@Grab(group='com.hackerrank.applications', module='junit-ordered-test-runner', version='1.0.2')
4040
)
4141
```
4242

4343
- [Apache Builder](buildr.apache.org)
4444
```
45-
'com.hackerrank.applications:junit-ordered-test-runner:jar:1.0.1'
45+
'com.hackerrank.applications:junit-ordered-test-runner:jar:1.0.2'
4646
```
4747

4848
## Sample Usage
@@ -161,26 +161,6 @@ You can refer the given [test examples](src/test/java/com/hackerrank/test/utilit
161161
- The `TestWatcher` generates an XML report in the `target/hackerrank-report` directory. The filename is `TEST-{test-class-canonical-name}.xml`.
162162
- When running tests in a suite, suite report, as well as individual test reports, will be generated.
163163

164-
## Report Formatting
165-
166-
In test suite use `ReportFormatter.format(path)` to update the test name in canonical format, i.e., `{package}.{class_name}.{test_name}`. The path must be relative to the project directory. For example:
167-
```java
168-
package com.hackerrank.test;
169-
170-
@RunWith(Suite.class)
171-
@Suite.SuiteClasses({
172-
com.hackerrank.test.FirstTest.class,
173-
com.hackerrank.test.SecondTest.class
174-
})
175-
public class TestSuite {
176-
177-
@AfterClass
178-
public static void tearDownClass() throws Exception {
179-
ReportFormatter.format("target/surefire-reports/TEST-com.hackerrank.test.TestSuite.xml");
180-
}
181-
}
182-
```
183-
184164
## Building Project
185165

186166
- Use `mvn clean build` to build the project.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.hackerrank.applications</groupId>
66
<artifactId>junit-ordered-test-runner</artifactId>
7-
<version>1.0.1</version>
7+
<version>1.0.2</version>
88
<packaging>jar</packaging>
99

1010
<name>${project.groupId}:${project.artifactId}</name>

src/main/java/com/hackerrank/test/utility/ReportFormatter.java

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/main/java/com/hackerrank/test/utility/ReportGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/**
3535
* @author Abhimanyu Singh
3636
37-
* @version 1.0.0
37+
* @version 1.0.2
3838
* @since 1.0.0
3939
*/
4040
public class ReportGenerator {
@@ -129,8 +129,7 @@ private static Element createReport(String className, List<TestObject> tests) {
129129
Element testcase = new Element("testcase");
130130

131131
Attribute classname = new Attribute("classname", className);
132-
Attribute name = new Attribute("name", test.getName());
133-
132+
Attribute name = new Attribute("name", className + "." + test.getName());
134133
double testTime = test.getExecutionTime();
135134
executionTime += testTime;
136135

0 commit comments

Comments
 (0)