Skip to content

Commit e31143f

Browse files
authored
Merge pull request #420 from Art4/improve-commands-for-bdt
Improve BDD with new testing command
2 parents dfa6b49 + e502824 commit e31143f

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@
5050
"sort-packages": true
5151
},
5252
"scripts": {
53-
"behat": "behat --config tests/Behat/behat.yml --format progress",
53+
"bdt": [
54+
"@behat --format=progress --suite=redmine_50103",
55+
"@behat --format=progress --suite=redmine_50009",
56+
"@behat --format=progress --suite=redmine_40210"
57+
],
58+
"behat": "behat --config tests/Behat/behat.yml",
5459
"codestyle": "php-cs-fixer fix",
5560
"coverage": "phpunit --coverage-html=\".phpunit.cache/code-coverage\"",
5661
"phpstan": "phpstan analyze --memory-limit 512M --configuration .phpstan.neon",

tests/Behat/README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,35 @@ Pull the Redmine docker images and start them by running:
1010
docker compose up -d
1111
```
1212

13-
Now you can run the tests:
13+
Now you can run all behaviour-driven tests grouped by Redmine version using the `bdt` command:
1414

1515
```bash
1616
# all tests
17-
docker compose exec php composer behat
18-
# only a specific redmine version
17+
docker compose exec php composer bdt
18+
```
19+
20+
If you need more control about the behat tests or want to change the output format,
21+
you can use the `behat` command directly:
22+
23+
```bash
24+
# test only a specific redmine version
1925
docker compose exec php composer behat -- --suite=redmine_50103
20-
# only specific endpoints
26+
# test only specific endpoints
2127
docker compose exec php composer behat -- --tags=issue,group
22-
# only specific endpoints on a specific redmine version
28+
# test only specific endpoints on a specific redmine version
2329
docker compose exec php composer behat -- --suite=redmine_50103 --tags=issue,group
30+
# test only a specific redmine version and format the output as `progress` (default is `pretty`)
31+
docker compose exec php composer behat -- --suite=redmine_50103 --format=progress
2432
```
2533

26-
## Redmine specific features
34+
## Redmine version specific features
2735

28-
Some Redmine features are specific for a Redmine version. There are two ways to handle this situations.
36+
Some Redmine features are specific for a Redmine version. Theses situations are handled in different ways.
2937

3038
### Modified Rest-API Responses
3139

3240
It is possible that a new Redmine version returns new or changed elements in a response.
33-
This can be handled on the `step` layer:
41+
This can be handled on the `step` layer (note the missing `homepage` property in `< 5.1.0`):
3442

3543
```
3644
And the returned data "projects.0" property has only the following properties with Redmine version ">= 5.1.0"
@@ -40,29 +48,20 @@ This can be handled on the `step` layer:
4048
identifier
4149
description
4250
homepage
43-
status
44-
is_public
45-
inherit_members
46-
created_on
47-
updated_on
4851
"""
4952
But the returned data "projects.0" property has only the following properties with Redmine version "< 5.1.0"
5053
"""
5154
id
5255
name
5356
identifier
5457
description
55-
status
56-
is_public
57-
inherit_members
58-
created_on
59-
updated_on
6058
"""
6159
```
6260

6361
### New Rest-API Endpoints
6462

65-
A new Redmine version could be introduce new REST-API endpoints that are missing in the older version.
63+
A new Redmine version could introduce new REST-API endpoints.
64+
Tests for this endpoint should not be run on older Redmine versions.
6665
This can be handled on the `scenario` or `feature` layer.
6766

6867
1. Tag features or scenarios e.g. with `@since50000`.
@@ -98,7 +97,8 @@ default:
9897

9998
### Removed Rest-API Endpoints
10099

101-
A new Redmine version could remove REST-API endpoints that are missing in the newer versions.
100+
A new Redmine version could remove REST-API endpoints.
101+
Tests for this endpoint should not be run on newer Redmine versions.
102102
This can be handled on the `scenario` or `feature` layer.
103103

104104
1. Tag features or scenarios e.g. with `@until60000`.

0 commit comments

Comments
 (0)