Sample Code for GitLab Pipeline Java Performance Testing
The sample code is as follows:
stages:
- build
- test
- deploy
source-code-migration:
stage: build
tags:
- kunpeng_java_builder # This is the tag used during gitlab-runner registration. Multiple tags may be selected.
script:
- echo '====== java-performance-analysis ======'
- CURDIR=$(pwd)
# Delete the report generated by JMeter last time (file and path specified by the -l and -o parameters in the JMeter command).
- rm -rf /home/tester/report /home/tester/result.html
# Run Java performance data collection.
- /root/.local/devkit_tester/bin/entrance -i 160.0.1.2,160.0.1.3 -u root -f /root/.ssh/id_rsa -D 160.0.1.5 -a spring-boot -d 10 -g /root/spring-boot -j "sh /root/apache-jmeter-5.6.3/bin/jmeter.sh -nt /root/Test_request.jmx -l /home/tester/result.html -eo /home/tester/report" -m /root/.local/bisheng-jdk-17.0.10
- cp /root/.local/devkit_tester/data/devkit_performance_report.html ${CURDIR}
artifacts:
paths:
# Upload the report.
- devkit_performance_report.html # File name extension .html.
name: Java_Performance_Report
- /home/tester/report: JMeter report output path.
- /home/tester/result.html: Result file generated by JMeter.
- /root/.local/devkit_tester/bin/entrance: Path to the Java Performance Testing tool.
- /root/.ssh/id_rsa: Path to the private key.
- spring-boot: Name of the application from which data is to be collected.
- /root/spring-boot: Path to the code downloaded using git clone on the worker node.
- /root/apache-jmeter-5.6.3/bin/jmeter.sh: Path to the JMeter tool.
- /root/Test_request.jmx: Path to JMeter test files.
- /root/.local/bisheng-jdk-17.0.10: Path to BiSheng JDK 17.
- /root/.local/devkit_tester/data/devkit_performance_report.html: Path for generating Java performance test reports.
Replace the preceding example values with actual values.
Parent topic: Java Performance Testing Tool