-
-
Notifications
You must be signed in to change notification settings - Fork 616
refactor: use fixtures for hook failure tests #1688
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
refactor: use fixtures for hook failure tests #1688
Conversation
| Scenario: First scenario | ||
| When I have a simple step | ||
| """ | ||
| Given I initialise the working directory from the "HookFailures" fixtures folder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the fixtures from the "HookFailures" folder
| And I provide the following options for all behat invocations: | ||
| | option | value | | ||
| | --no-colors | | | ||
| | --format | json | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define the output format for all tests
| When I run "behat --no-colors --format=json --out=beforesuite.json" | ||
| When I run behat with the following additional options: | ||
| | option | value | | ||
| | --profile | beforeSuite | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the profile that matches what we want to test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing this with annotations does not provide any real value. We already test that hook annotations are processed in other tests and the hook failures tests are about the output when one of these failures happen
| Scenario: First scenario | ||
| When I have a simple step | ||
| """ | ||
| Given I initialise the working directory from the "HookFailures" fixtures folder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests use the same fixture folder for all formatters
| { | ||
| private static bool $thrown = false; | ||
|
|
||
| protected static function throwFailure(string $message): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We implement a function that only throws an exception the first time it is called, this allows us to use this with several suites, features, scenarios or steps
acoulton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner, thanks @carlos-granados
Updates the hook failures tests to use fixtures instead of files created on the fly. Uses a single fixture folder for all hook failures tests. Removes hook failure tests for annotations