splendo / CucumberMultiplatform

Apache License 2.0
2 stars 0 forks source link

Gherkin syntax `Given` #26

Open corrado4eyes opened 10 months ago

corrado4eyes commented 10 months ago

The purpose of Given steps is to put the system in a known state, by initialising the local db or logging in a test user. Docs

feature("Some feature") {
    scenario("Some scenario") {
         given("The user is logged in") {
             // initialise logged in user
         }
         given("The user email is ${someValue}") {
             // set user email to be "someValue"
         }
    }
}
ChristoferAlexander commented 10 months ago

We can also favor utilizing "background" here to create a pre condition for all scenarios.

Ideally in my opinion we should approach the issue on UI level only and avoid having steps like "The user is logged in"

Instead that could be replaced by a background scenario that does:

Background: Given you see the login screen Then fill "user1" on edit text "username" Then fill "123" on edit text "pass" Then press login button

Playing a bit also with @BeforeStep and @AfterStep we could make it so a tester alone can write any test without any developer work plus this way all steps are performed on the UI like a tester would and there is no under the hood state setup.