-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
And or But keywords is kind of syntactic sugar for the Gherkin syntax. They are used to avoid to be repetitive when describing some scenarios.
Instead of writing
feature("Some feature") {
scenario("Some scenario") {
given("The user is logged in") {
// initialise user to be logged off
}
given("The user is not premium") {
// initialise non premium user
}
then("The user should see the Home view") {
// assert that the user sees the Home view and not another
}
then("The user should see the Upgrade button") {
// assert toolbar is visible
}
}
}One could simplify it
feature("Some feature") {
scenario("Some scenario") {
given("The user is logged in") {
// initialise user to be logged off
}.but("The user is not premium") {
// initialise non premium user
}
then("The user should see the Home view") {
// assert that the user sees the Home view and not another
}.and("The user should see the Upgrade button") {
// assert toolbar is visible
}
}
}To note that but and and are basically an extension of then, when and given builder methods
Metadata
Metadata
Assignees
Labels
No labels