Skip to content

Commit fbdced2

Browse files
Update rerun-failed-tests.adoc (#9363)
Add Codeception example. Co-authored-by: Rosie Yohannan <[email protected]>
1 parent 9198c0b commit fbdced2

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

jekyll/_cci2/rerun-failed-tests.adoc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,45 @@ gem 'minitest-ci'
505505
path: test/reports
506506
```
507507

508+
[#configure-a-job-running-codeception-tests]
509+
=== Configure a job running Codeception tests
510+
511+
Codeception doesn't support providing paths to multiple files in a single `codecept run` command execution directly. We can circumvent this by creating a dynamic group. Add the following to your `codeception.yml` file:
512+
513+
[,yml]
514+
----
515+
groups:
516+
circleci: tests/_output/circleci
517+
----
518+
519+
In your `.circleci/config.yml` file, we can use `circleci tests glob` to get the Cest files from the path we need. `circleci tests run` will then sift through the Cest files and put the necessary ones into `tests/_output/circleci` file. Before running the tests with the `circleci` group, we ensure the `tests/_output/circleci` file exists. The `--xml` option is required for the rerun tests feature to work. The `--html` option is optional, but useful for easy debugging through artifacts.
520+
521+
[,yml]
522+
----
523+
jobs:
524+
my_test_job:
525+
parallelism: 2
526+
docker:
527+
- image: codeception/codeception:5.1.2
528+
steps:
529+
- checkout
530+
- run:
531+
name: Run the acceptance tests
532+
command: |
533+
circleci tests glob ${CIRCLE_WORKING_DIRECTORY}/tests/Acceptance/**/*Cest.php | circleci tests run --command="xargs -I{} echo {} >> tests/_output/circleci" --verbose --split-by=timings
534+
if [ -f tests/_output/circleci ]; then
535+
codecept run -g circleci --xml --html
536+
else
537+
exit 0
538+
fi
539+
- store_test_results:
540+
name: Store test results (junit xml file).
541+
path: tests/_output
542+
- store_artifacts:
543+
name: Store test results (html and image files).
544+
path: tests/_output
545+
----
546+
508547
[#output-test-files-only]
509548
=== Output test files only
510549

0 commit comments

Comments
 (0)