У нас есть работа в Gitlab для нашего интеграционного проекта Jmeter + Maven.Который запустит файл .jmx, сгенерирует отчет панели мониторинга jmeter и отправит письмо.Ниже приведен мой yml-файл
stages:
- test
test_ba_bpmm_qaa-jb:
stage: test
tags:
- qa-api-automation
script:
- echo "-------------Running maven command to run jmeter tests---------"
- pwd
- mvn clean install
- echo "-------------------Execution completed---------"
- cd target/jmeter
- pwd
- zip -r bpm_api_testresult.zip reports
- echo "This is the message body" | swaks --to abc@xyz.com --from
"contact@xyz.com" --server 192.178.176.45 --auth LOGIN --auth-user
"qauser1@sip.test" --auth-password "abc123" --attach
"bpm_api_testresult.zip"
allow_failure: false
only:
- master
И следующий вывод:
[INFO] -------------------------------------------------------
[INFO] P E R F O R M A N C E T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO]
[INFO] Executing test: Master_BPM_APIs.jmx
[INFO] Starting process with:[java, -Xms512M, -Xmx512M, -jar, ApacheJMeter-
4.0.jar, -d, /home/gitlab-runner/builds/af1bddbf/0/sip-jbpm6-5/bpm-api-
automation/target/jmeter, -e, -j, /home/gitlab-runner/builds/af1bddbf/0/sip-
jbpm6-5/bpm-api-automation/target/jmeter/logs/Master_BPM_APIs.jmx.log, -l,
/home/gitlab-runner/builds/af1bddbf/0/sip-jbpm6-5/bpm-api-
automation/target/jmeter/results/Master_BPM_APIs.csv, -n, -o, /home/gitlab-
runner/builds/af1bddbf/0/sip-jbpm6-5/bpm-api-
automation/target/jmeter/reports/Master_BPM_APIs_20181023_164847, -t,
/home/gitlab-runner/builds/af1bddbf/0/sip-jbpm6-5/bpm-api-
automation/target/jmeter/testFiles/Master_BPM_APIs.jmx]
[INFO] Creating summariser <summary>
[INFO] Created the tree successfully using /home/gitlab-
runner/builds/af1bddbf/0/sip-jbpm6-5/bpm-api-
automation/target/jmeter/testFiles/Master_BPM_APIs.jmx
[INFO] Starting the test @ Tue Oct 23 16:48:50 IST 2018 (1540293530191)
[INFO] Waiting for possible Shutdown/StopTestNow/Heapdump message on port
4445
[INFO] 1
[INFO] summary = 8 in 00:00:02 = 4.6/s Avg: 82 Min: 2 Max:
207 Err: 1 (12.50%)
[INFO] Tidying up ... @ Tue Oct 23 16:48:52 IST 2018 (1540293532577)
[INFO] ... end of run
[INFO] Completed Test: /home/gitlab-runner/builds/af1bddbf/0/sip-jbpm6-
5/bpm-api-automation/target/jmeter/testFiles/Master_BPM_APIs.jmx
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ bpm-api-
automation ---
[INFO] Installing /home/gitlab-runner/builds/af1bddbf/0/sip-jbpm6-5/bpm-api-
automation/target/bpm-api-automation-0.0.1-SNAPSHOT.jar to /home/gitlab-
runner/.m2/repository/com/causeway/bpm/bpm-api-automation/0.0.1-
SNAPSHOT/bpm-api-automation-0.0.1-SNAPSHOT.jar
[INFO] Installing /home/gitlab-runner/builds/af1bddbf/0/sip-jbpm6-5/bpm-api-
automation/pom.xml to /home/gitlab-
runner/.m2/repository/com/causeway/bpm/bpm-api-automation/0.0.1-
SNAPSHOT/bpm-api-automation-0.0.1-SNAPSHOT.pom
[INFO] ---------------------------------------------------------------------
---
[INFO] BUILD SUCCESS
[INFO] ---------------------------------------------------------------------
---
[INFO] Total time: 11.011 s
[INFO] Finished at: 2018-10-23T16:48:54+05:30
[INFO] ---------------------------------------------------------------------
---
[INFO] Shutdown detected, destroying JMeter process...
[32;1m$ echo "-------------------Execution completed---------"[0;m
-------------------Execution completed---------
Но что нам нужно, если любая ошибка / тестовый сбой, то сборка должна установить сбой или вернуть состояние сборки0 или 1 и возвращает ошибку завершения в консоли журнала заданий