diff --git a/05-test-execution-and-reporting.md b/05-test-execution-and-reporting.md index e69de29..4542943 100644 --- a/05-test-execution-and-reporting.md +++ b/05-test-execution-and-reporting.md @@ -0,0 +1,50 @@ +# Key CI/CD/Jenkins Concepts and their Usage + +## Displaying JUnit and JaCoCo test results + +1. Configure the `gradle-initializr` project to parse the JUnit XML results for unit test. The files can be found in the directory `build/test-results/test`. +2. Execute the build twice to generate a graph. Have a look at the executed tests in the test results. +3. Include all test results (unit and integration tests) in the reporting. +4. Have a look at how the test result trend changes. +5. Install the JaCoCo plugin. +6. Reconfigure the Gradle build step to also generate JaCoCo reports: `clean build jacocoTestReport jacocoIntegrationTestReport`. +7. Add a post-build action for publish the JaCoCo reports. Use the following path to look for results: `build/jacoco/**.exec`. +8. Execute the build twice to generate a graph. Have a look at the code coverage results. + +
Show Solution +

+ +Publish the JUnit reports by pointing to the exact directory containing the XML files. + +![Publish JUnit Results](./images/05-test-execution-and-reporting/publish-unit-tests.png) + +After executing the build twice you will see a test result trend graph. + +![JUnit Test Trend](./images/05-test-execution-and-reporting/unit-test-result-trend.png) + +Publish the JUnit reporting by using a wild card. + +![Publish All JUnit Results](./images/05-test-execution-and-reporting/publish-all-tests.png) + +The trend changes accordingly. + +![Changed Test Result Trend](./images/05-test-execution-and-reporting/all-test-result-trend.png) + +Install the JaCoCo plugin. + +![JaCoCo Plugin](./images/05-test-execution-and-reporting/jacoco-plugin.png) + +Change the task list executed by the Gradle build step. + +![JaCoCo Tasks](./images/05-test-execution-and-reporting/jacoco-tasks.png) + +Configure JaCoCo reporting. + +![JaCoCo Configuration](./images/05-test-execution-and-reporting/jacoco-config.png) + +The JaCoCo coverage trend renders after executing the build twice. + +![JaCoCo Coverage Report Trend](./images/05-test-execution-and-reporting/jacoco-trend.png) + +

+
\ No newline at end of file diff --git a/images/05-test-execution-and-reporting/all-test-result-trend.png b/images/05-test-execution-and-reporting/all-test-result-trend.png new file mode 100644 index 0000000..34bebbb Binary files /dev/null and b/images/05-test-execution-and-reporting/all-test-result-trend.png differ diff --git a/images/05-test-execution-and-reporting/jacoco-config.png b/images/05-test-execution-and-reporting/jacoco-config.png new file mode 100644 index 0000000..5d0bd19 Binary files /dev/null and b/images/05-test-execution-and-reporting/jacoco-config.png differ diff --git a/images/05-test-execution-and-reporting/jacoco-plugin.png b/images/05-test-execution-and-reporting/jacoco-plugin.png new file mode 100644 index 0000000..4c6ab1d Binary files /dev/null and b/images/05-test-execution-and-reporting/jacoco-plugin.png differ diff --git a/images/05-test-execution-and-reporting/jacoco-report.png b/images/05-test-execution-and-reporting/jacoco-report.png new file mode 100644 index 0000000..83b5177 Binary files /dev/null and b/images/05-test-execution-and-reporting/jacoco-report.png differ diff --git a/images/05-test-execution-and-reporting/jacoco-tasks.png b/images/05-test-execution-and-reporting/jacoco-tasks.png new file mode 100644 index 0000000..21ce025 Binary files /dev/null and b/images/05-test-execution-and-reporting/jacoco-tasks.png differ diff --git a/images/05-test-execution-and-reporting/jacoco-trend.png b/images/05-test-execution-and-reporting/jacoco-trend.png new file mode 100644 index 0000000..33a29bb Binary files /dev/null and b/images/05-test-execution-and-reporting/jacoco-trend.png differ diff --git a/images/05-test-execution-and-reporting/publish-all-tests.png b/images/05-test-execution-and-reporting/publish-all-tests.png new file mode 100644 index 0000000..90bd436 Binary files /dev/null and b/images/05-test-execution-and-reporting/publish-all-tests.png differ diff --git a/images/05-test-execution-and-reporting/publish-unit-tests.png b/images/05-test-execution-and-reporting/publish-unit-tests.png new file mode 100644 index 0000000..844c9cc Binary files /dev/null and b/images/05-test-execution-and-reporting/publish-unit-tests.png differ diff --git a/images/05-test-execution-and-reporting/test-result.png b/images/05-test-execution-and-reporting/test-result.png new file mode 100644 index 0000000..c01dfd9 Binary files /dev/null and b/images/05-test-execution-and-reporting/test-result.png differ diff --git a/images/05-test-execution-and-reporting/unit-test-result-trend.png b/images/05-test-execution-and-reporting/unit-test-result-trend.png new file mode 100644 index 0000000..c08f839 Binary files /dev/null and b/images/05-test-execution-and-reporting/unit-test-result-trend.png differ