add test-plan to test jmeter test #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: JMeter Test Pipeline | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
jmeter-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install JMeter | |
run: | | |
sudo apt update | |
sudo apt install -y jmeter | |
- name: Create results directory | |
run: mkdir -p ./tests | |
- name: Run JMeter tests | |
run: jmeter -n -t ./tests/test-plan.jmx -l ./tests/test-results.jtl -Djava.security.manager=allow | |
- name: List files in tests directory | |
run: ls -R ./tests | |
- name: Check JMeter results | |
run: | | |
if [ -f ./tests/test-results.jtl ]; then | |
grep "Failure" ./tests/test-results.jtl || echo "No failures found in test results." | |
else | |
echo "Test results file not found." | |
exit 1 | |
fi | |
- name: Upload JMeter report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jmeter-report | |
path: ./tests/test-results.jtl |