PLANET-5167: Introduction of features descriptions as tests #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refs:
Follow-up of PoC: PoC for BDD tests #77
A short reminder about Gherkin
This PR implements tests in a Gherkin format, run by Codeception.
By implementing reusable sentences and making available a documented list of those, we can try to reach a point where a tester (non-coder) writes a feature file that is playable as is, without any technical intervention. Even if this goal is not fully reached, this might greatly help with tests readability and organization for the whole team.
Tests look like this (keywords hilighted in red, parameters quoted):
Implementation looks like this (sentences are matched by annotations
@Given
,@When
,@Then
):What changed since #77
GutenbergEditor::addBlock
can only takeBlockSection
andBlockName
as params and will say so if failing, which is more explicit than failing because the selector was not found in the page)Given
When
andThen
) were moved toStep\
namespacePage\
namespace is used for interactions with pages that are not steps but that can be used by stepsCommands
p4:selectors
p4:steps <suite> [-i]
@example
)-i
displays theclass::method
implementing the sentenceTest
Tests passed in the CI :https://app.circleci.com/pipelines/github/greenpeace/planet4-base-fork/452/workflows/8e5b6c62-e0c4-437e-a4f5-5217fea3dac0/jobs/5075/steps.
Run it locally with
tests/vendor/bin/codecept run -vv acceptance editor.feature
Review guide
tests/__support/Command
The two commands added, started by copying
Codeception\Command\GherkinSteps
tests/__support/Selector
All selectors, grouped by zone as
Enum
tests/__support/Step
All steps, grouped by topic/zone
tests/__support/Page
Pages interactions not declared as steps (for internal use, type hinting, etc.)
codeception.yml
, added steps toacceptance.suite.yml
Next
p4:steps
to make it always available and up to date for test writers.%s
when-then
in the same scenario