To record unit test results to the pipeline's run log:
The following example pipeline demonstrates the process of generating unit test results in a Maven build and recording the results to the run log for later viewing in Pipelines.
resources: - name: java_app type: GitRepo configuration: gitProvider: MyGithub path: myproject/simple-maven-sample branches: include: master - name: my_build_info type: BuildInfo configuration: sourceArtifactory: myArtifactory buildName: simple-maven-sample buildNumber: 1
The pipeline executes a Maven build using the MvnBuild native step. It requires that the Maven project being built has been configured to use the to perform unit tests and produce a junit-compatible test result file.
onComplete action of the
execution block, the step will save the test result file to the run log by calling the
save_tests utility function.
pipelines: - name: java_pipeline steps: - name: build_app type: MvnBuild configuration: sourceLocation: . mvnCommand: clean install -ntp configFileLocation: . configFileName: mvn-art-config autoPublishBuildInfo: true integrations: - name: myArtifactory inputResources: - name: java_app outputResources: - name: my_build_info runtime: type: image image: auto: language: java versions: - "11" execution: onComplete: - save_tests $res_java_app_resourcePath/target/surefire-reports/
After the pipeline is run, the test results can be viewed in the run log for the