summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-09-03 11:42:16 +0000
committerRémy Coutable <remy@rymai.me>2018-09-03 11:42:16 +0000
commit31ead6ccf84cb86f508c9b962ac88c79845825ab (patch)
tree8fee3585d46975d81d13a8a3cb2508ee89ead2bf
parentb2bdb004072a36cb2fb81df0f3d7e68a307bc09c (diff)
parentf2999c98c90bafa5e9d7d85ab6e113df1f56fdf8 (diff)
downloadgitlab-ce-31ead6ccf84cb86f508c9b962ac88c79845825ab.tar.gz
Merge branch 'docs/junit-examples' into 'master'
Add JUnit Java examples in docs See merge request gitlab-org/gitlab-ce!21472
-rw-r--r--doc/ci/junit_test_reports.md39
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/ci/junit_test_reports.md b/doc/ci/junit_test_reports.md
index 5ae8ecaafa6..6717dd2dad1 100644
--- a/doc/ci/junit_test_reports.md
+++ b/doc/ci/junit_test_reports.md
@@ -100,3 +100,42 @@ golang:
reports:
junit: report.xml
```
+
+### Java examples
+
+There are a few tools that can produce JUnit reports in Java.
+
+#### Gradle
+
+In the following example, `gradle` is used to generate the test reports.
+If there are multiple test tasks defined, `gradle` will generate multiple
+directories under `build/test-results/`. In that case, you can leverage regex
+matching by defining the following path: `build/test-results/test/TEST-*.xml`:
+
+```yaml
+java:
+ stage: test
+ script:
+ - gradle test
+ artifacts:
+ reports:
+ junit: build/test-results/test/TEST-*.xml
+```
+
+#### Maven
+
+For parsing [Surefire](https://maven.apache.org/surefire/maven-surefire-plugin/)
+and [Failsafe](https://maven.apache.org/surefire/maven-failsafe-plugin/) test
+reports, use the following job in `.gitlab-ci.yml`:
+
+```yaml
+java:
+ stage: test
+ script:
+ - mvn verify
+ artifacts:
+ reports:
+ junit:
+ - target/surefire-reports/TEST-*.xml
+ - target/failsafe-reports/TEST-*.xml
+```