Skip to content

Commit

Permalink
Documentation Update: Using directories to define groups (Codeception…
Browse files Browse the repository at this point in the history
…#3921)

* Using directories to define groups

Closes Codeception#3919

* Update 07-AdvancedUsage.md
  • Loading branch information
DavertMik authored and bulzgkri committed Jun 16, 2017
1 parent 9418b3d commit dc95037
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions docs/07-AdvancedUsage.md
Expand Up @@ -231,6 +231,7 @@ These examples can be written using Doctrine-style annotation syntax as well:
```

You can also use the `@dataprovider` annotation for creating dynamic examples, using a protected method for providing example data:

```php
<?php
/**
Expand Down Expand Up @@ -260,6 +261,7 @@ You can also use the `@dataprovider` annotation for creating dynamic examples, u
Alternatively, the `@dataprovider` can also be a public method starting with `_` prefix so it will not be considered as a test:

```php
<?php
/**
* @dataprovider _pageProvider
*/
Expand Down Expand Up @@ -623,25 +625,31 @@ Feature: Admin area
### Group Files

Groups can be defined in global or suite configuration files.
Tests for groups can be specified as an array or as a path to a file containing a list of groups:
Tests for groups can be specified as an array of file names or directories containing them:

```yaml
groups:
# add 2 tests to db group
db: [tests/unit/PersistTest.php, tests/unit/DataTest.php]

# add list of tests to slow group
slow: tests/_data/slow
# add all tests from a directory to api group
api: [tests/functional/api]
```

For instance, you can create a file with the list of the slowest tests, and run them inside their own group.
Group file is a plain text file with test names on separate lines:
A list of tests for the group can be passed from a Group file. It should be defined in plain text with test names on separate lines:

```bash
tests/unit/DbTest.php
tests/unit/UserTest.php:create
tests/unit/UserTest.php:update
```
A group file can be included by its relative filename:

```yaml
groups:
# requiring a group file
slow: tests/_data/slow.txt
```

You can create group files manually or generate them from third party applications.
For example, you can write a script that updates the slow group by taking the slowest tests from xml report.
Expand All @@ -655,6 +663,7 @@ groups:

This will load all found `p*` files in `tests/_data` as groups. Group names will be as follows p1,p2,...,pN.


## Conclusion

Codeception is a framework which may look simple at first glance
Expand Down

0 comments on commit dc95037

Please sign in to comment.