Skip to content

Commit 7a7df6a

Browse files
author
David Ferlay
authored
Merge pull request #283 from skilld-labs/behat-junit
Allow Gitlab to parse behat results
2 parents 45bbdd4 + 55afd6d commit 7a7df6a

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ docker/docker-compose.override.yml
1717
behat.yml
1818
features/*.html
1919
features/*.png
20+
features/junit/
2021
.cache/
2122
.editorconfig
2223
.gitattributes

.gitlab-ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,15 @@ test:behat:
257257
script:
258258
- echo "Starting job script in ${BUILD_DIR}"
259259
- cd ${BUILD_DIR}
260-
- make behat
260+
- BEHAT_ARGS='--colors -f pretty -o std -f junit -o features/junit' make behat
261261
after_script:
262262
- cd ${BUILD_DIR}
263263
- make browser_driver_stop
264264
- rm -rf web/screenshots
265265
- mkdir web/screenshots
266266
- mv features/*.png web/screenshots/
267267
- echo "- Screenshots are available here :" && cd web/screenshots && ls -h *.png | xargs -i echo "${CI_ENVIRONMENT_URL}/screenshots/{}"
268+
- mv ${BUILD_DIR}/features/junit ${CI_PROJECT_DIR}
268269
retry:
269270
max: 2
270271
when: script_failure
@@ -273,6 +274,13 @@ test:behat:
273274
allow_failure: false
274275
<<: *runner_tag_selection
275276
<<: *only_branches
277+
artifacts:
278+
expire_in: 1 week
279+
when: always
280+
paths:
281+
- junit/*.xml
282+
reports:
283+
junit: junit/*.xml
276284

277285
test:cinsp:
278286
stage: tests

scripts/makefile/tests.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ else
125125
endif
126126

127127
## Validate Behat scenarios
128+
BEHAT_ARGS ?= --colors
128129
behat:
129130
@echo "Getting base url"
130131
ifdef REVIEW_DOMAIN
@@ -143,7 +144,7 @@ endif
143144
@echo "Running Behat scenarios against http://$(BASE_URL)"
144145
$(call php, composer install -o)
145146
$(call php, vendor/bin/behat -V)
146-
$(call php, vendor/bin/behat --colors) || $(call php, vendor/bin/behat --colors --rerun)
147+
$(call php, vendor/bin/behat $(BEHAT_ARGS)) || $(call php, vendor/bin/behat $(BEHAT_ARGS) --rerun)
147148
make browser_driver_stop
148149

149150
## List existing behat definitions

0 commit comments

Comments
 (0)