Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1200] Added behat code coverage tool. #1229

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,19 @@ jobs:
fi
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli ./scripts/drevops/provision.sh
no_output_timeout: 30m
- run:
name: Restart server with Xdebug enabled for coverage
command: XDEBUG_ENABLE=true docker compose up -d cli php nginx
- run:
name: Test with PHPUnit
command: |
XDEBUG_ENABLE=true docker compose up -d cli php nginx # Restart stack with XDEBUG enabled for coverage.
docker compose exec -T -e XDEBUG_MODE=coverage cli vendor/bin/phpunit || [ "${DREVOPS_CI_PHPUNIT_IGNORE_FAILURE:-0}" -eq 1 ]
docker compose up -d cli php nginx # Restart stack without XDEBUG enabled for coverage.
- run:
name: Test with Behat
command: |
if [ "${CIRCLE_NODE_TOTAL:-1}" -gt 1 ]; then export DREVOPS_CI_BEHAT_PROFILE="${DREVOPS_CI_BEHAT_PROFILE:-p${CIRCLE_NODE_INDEX}}"; fi
echo "Running with ${DREVOPS_CI_BEHAT_PROFILE:-default} profile"
docker compose exec -T cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --profile="${DREVOPS_CI_BEHAT_PROFILE:-default}" || \
docker compose exec -T -e XDEBUG_MODE=coverage cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --profile="${DREVOPS_CI_BEHAT_PROFILE:-default}" || \
docker compose exec -T cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --rerun --profile="${DREVOPS_CI_BEHAT_PROFILE:-default}" || \
[ "${DREVOPS_CI_BEHAT_IGNORE_FAILURE:-0}" -eq 1 ]
no_output_timeout: 30m
Expand Down
29 changes: 28 additions & 1 deletion behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,34 @@ default:
purge: false # Change to 'true' (no quotes) to purge screenshots on each run.
# Show explicit fail information and continue the test run.
DrevOps\BehatFormatProgressFail\FormatExtension: ~

DVDoug\Behat\CodeCoverage\Extension:
cache: '/tmp/behat_code_coverage_cache'
branchAndPathCoverage: false
# The processUncoveredFiles setting has been removed in php-code-coverage v10.0.0.
filter:
includeUncoveredFiles: true
include:
directories:
'web/modules/custom': ~
'web/themes/custom': ~
'web/sites/default/includes': ~
'tests/behat/bootstrap': ~
files:
- 'web/sites/default/settings.php'
exclude:
directories:
'web/modules/custom':
suffix: 'Test.php'
'web/themes/custom':
suffix: 'Test.php'
reports:
text:
showColors: true
showOnlySummary: true
html:
target: '%paths.base%/.logs/coverage/behat/.coverage-html'
cobertura:
target: '%paths.base%/.logs/coverage/behat/cobertura.xml'
# Profile for parallel testing.
# Runs all tests not tagged with "smoke" or "@p1" and not tagged with "@skipped".
p0:
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"drevops/behat-steps": "^2.2",
"drupal/core-dev": "^10.2.0",
"drupal/drupal-extension": "^5@rc",
"dvdoug/behat-code-coverage": "^5.3",
"mglaman/phpstan-drupal": "^1.2",
"palantirnet/drupal-rector": "^0.20",
"phpcompatibility/php-compatibility": "^9.3",
Expand Down
Loading