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

[n/a] Update testing docs. Add codecept helpers #86

Merged
merged 2 commits into from
May 25, 2024
Merged
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
3 changes: 3 additions & 0 deletions .ddev/commands/web/codecept.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Usage: codecept
## Description: Run codeception for this project
vendor/bin/codecept "$@"
2 changes: 1 addition & 1 deletion .github/workflows/codecept.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
# Install MySQL
mysql:
image: bitnami/mysql:latest
image: bitnami/mysql:8.0.37
env:
MYSQL_ROOT_PASSWORD: mysecretpassword
MYSQL_DATABASE: craft_test
Expand Down
10 changes: 10 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ modules:
cleanup: true
transaction: true
dbSetup: { clean: true, setupCraft: true }
env:
# Call codecept run <command> --env fast
# Skips slow DB tasks. Test must be run without the --env
# flag at least once before this will work properly.
fast:
modules:
config:
\craft\test\Craft:
# Don't clean out the database
dbSetup: { clean: false, setupCraft: false, applyMigrations: false }
30 changes: 22 additions & 8 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,32 @@ nav_order: 7

# Testing

This repo utilizes Docker in order to run the test suite.
This repo utilizes DDEV in order to run the test suite locally.

1. Install [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/).
Tests are run in GitHub Actions when PRs are opened.

2. Build the containers
### Install DDEV
[DDEV](https://ddev.com/).

Run `docker-compose build`. This will take a little while.
### Launch DDEV
```
ddev start
```

3. Run the app
### Run the tests

Run `docker-compose up`.
```
# Run all tests
ddev codecept run unit

4. Run the tests
# Run specific test
ddev codecept run unit PartsKitTest

Run `bin/codecept run`
# Run without database setup (must run without env flag first)
ddev codecept run unit PartsKitTest --env fast

```

Run specific tests
```
```
Loading