Commit 477a5ff5 authored by Christian Keuerleber's avatar Christian Keuerleber
Browse files

TASK: move acceptance tests out of extensions

parent d41ef9fb
Pipeline #7872 failed with stages
in 15 seconds
......@@ -12,5 +12,5 @@
/.ddev/sequelpro.spf
/.data
/.idea
/extensions/t3omy_test/Tests/_output/
/extensions/t3omy_test/Tests/_support/_generated/
/Tests/_output/
/Tests/_support/_generated/
......@@ -24,7 +24,7 @@ to have a working site and add new data per test via yaml files and steps provid
`punktde/codeception-database` package. When a yaml file is imported via the gherkin step, every database table
found in the yaml file is truncated before the new data is imported.
In `extensions/t3omy_test/Tests/acceptance.suite.yml` the config for the database module can be found. We have set
In `Tests/acceptance.suite.yml` the config for the database module can be found. We have set
`populate` and `reset` to true, so before running any test and between every test the command given as the config
option `populator` is run. If no `populator` is given, the `dumpFile` is imported.
......@@ -38,13 +38,13 @@ We are running chromedriver in ddev, so if you use ddev everything is just worki
#### Run the tests
```
ddev run --service web vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml --steps run acceptance
ddev run --service web vendor/bin/codecept --steps run acceptance
```
With `--steps`, all run steps are outputted to the command line. All errors are reported even if you don't use the
flag. You can also add `--xml` as a flag to get JUnit compatible output.
If you get errors, you can find the output in the directory `extensions/t3omy_test/Tests/_output`. In there is a list of failed tests and
If you get errors, you can find the output in the directory `Tests/_output`. In there is a list of failed tests and
a screenshot and the html output of the page the moment a test failed.
##### Single feature
......@@ -52,23 +52,23 @@ a screenshot and the html output of the page the moment a test failed.
To run a single feature just add the path to the feature file to your command, e.g.
```
ddev run --service web vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml --steps run acceptance extensions/t3omy_test/Tests/acceptance/Features/Login.feature
ddev run --service web vendor/bin/codecept --steps run acceptance Tests/acceptance/Features/Login.feature
```
You can also run single scenarios by providing line numbers, e.g.
You can also run single scenarios by providing test names, e.g.
```
ddev run --service web vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml --steps run acceptance extensions/t3omy_test/Tests/acceptance/Features/Login.feature:10
ddev run --service web vendor/bin/codecept --steps run acceptance Tests/acceptance/Features/Login.feature:Login\ and\ Logout
```
### Writing tests
The acceptance tests are put into the directory `extensions/t3omy_test/Tests/acceptance/Feature`. You can use any folder structure to
The acceptance tests are put into the directory `Tests/acceptance/Feature`. You can use any folder structure to
group your tests.
To get all the available step definitions just run the command
```
ddev run --service web vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml gherkin:steps acceptance
ddev run --service web vendor/bin/codecept gherkin:steps acceptance
```
which outputs the steps added to the project.
......@@ -76,7 +76,7 @@ which outputs the steps added to the project.
To add new steps, just write the new step in your `.feature` file and run
```
ddev run --service web vendor/bin/codecept -c extensions/t3omy_test/Configuration/codeception.yml gherkin:snippets acceptance
ddev run --service web vendor/bin/codecept gherkin:snippets acceptance
```
This will output a function stub with the proper step definition phpdoc. Put this in a appropriate `ActorTrait`
......
......@@ -33,7 +33,7 @@ modules:
user: 'db'
password: 'db'
host: 'db'
dump: 'extensions/t3omy_test/Resources/Private/Dumps/Fixture.sql'
dump: 'Tests/_data/Dumps/Fixture.sql'
populate: true
cleanup: true
populator: 'mysql --host=$host --user=$user --password=$password $dbName < $dump'
......
paths:
tests: ../Tests
output: ../Tests/_output
data: ../Tests/_data
support: ../Tests/_support
envs: ../Tests/_envs
tests: Tests
output: Tests/_output
data: Tests/_data
support: Tests/_support
envs: Tests/_envs
actor_suffix: Tester
extensions:
enabled:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment