samedi 31 octobre 2020

Implementing Screenplay pattern for automated testing in swift

I'm currently learning the screenplay pattern but i'm having trouble with the Given keyword. For my current use case it seems that it should be a question.

Given(user).has(OpenedTheApplication.successfully())

has is defined as a task

func has(_ task: Task) {
    perform(task)
}

The gherkin keyword is defined as follows:

class Given: GherkinKeyword {
    func has(_ task: Task) {
        actor.has(task)
    }
}

So if I understand screenplay correctly then tasks should not create a query about the state of the system.

So rather I would like to define this:

Given(user).wasAbleTo(OpenTheApplication.toTheHomePage())

and then

func wasAbleTo(_ question: Question) {
    ask(question)
}

and the gherkin keyword is updated too:

class Given: GherkinKeyword {
    func has(_ task: Task) {
        actor.has(task)
    }
    func wasAbleTo(_ question: Question) {
        actor.wasAbleTo(question)
    }
}

is this a correct way of thinking for asserting that the application was launched correctly?

Aucun commentaire:

Enregistrer un commentaire