Acceptance steps of things that do or do not exist

Acceptance steps of things that do or do not exist

by Itamar Tzadok -
Number of replies: 6

Hopefully not nitpicking, acceptance steps of things that do or do not exist, currently phrased with 'should', e.g.

And "Log out" "link" should exist

should probably be phrased factually, e.g.

And "Log out" "link" does exist

The latter seems to make better sense in a scenario where I am doing things and I can tell for a fact if something exists or not.

smile

Average of ratings: -
In reply to Itamar Tzadok

Re: Acceptance steps of things that do or do not exist

by Rajesh Taneja -

Hello Itamar,

This has been improved by MDL-43236.

It has been updated to first suggested option. This is general step and should apply to different scenarios, if you still think later should be the used then please comment on MDL-43236 and this can be discussed again.

In reply to Rajesh Taneja

Re: Acceptance steps of things that do or do not exist

by Itamar Tzadok -

Thanks Rajesh.

MDL-43236 is closed and I don't think commenting on it would be useful. I will add instead an improvement issue. It does not have to change the existing 'should/should not' steps. It can just extend the set of steps with 'does/does not' steps which delegate to the 'should/should not' in the background. Then either phrasing could be used without duplicating much.

smile

In reply to Itamar Tzadok

Re: Acceptance steps of things that do or do not exist

by David Monllaó -

Hi Itamar,

The "should" is commonly used in Behaviour Driven Development frameworks as in the @Then section we have expectations, which are supposed to be true, but there is no guarantee that is true.

IMO we should not add more step definitions for the same purpose that other steps have, we should try to have a close but strong set of steps so it would be easier to remember; it would be even worst in this case as we would be duplicating a step, which would confuse users.

In reply to David Monllaó

Re: Acceptance steps of things that do or do not exist

by Itamar Tzadok -

In many cases acceptance tests are acceptance criteria for delivery. As acceptance criteria they need to be factual rather than potential. The client can set a criterion such as "When I go to A then I see X but I don't see Y". The testing language can match that. Just terminology, I know, but sometimes terminology may be useful.

Language speakers already cope with arguably quite confusing language. So I'm not worried that enriching the testing language with additional phrases for same steps would be a problem. This can be easily done by by aliases. I have not found any documentation on that but it turns out that you can declare more than one @Given in a step definition (without adding or duplicating code) and all these givens will be recognized as valid steps.

smile

In reply to Itamar Tzadok

Re: Acceptance steps of things that do or do not exist

by David Monllaó -

Hi Itamar,

As I guess you do it is not a technical problem smile I would resume my opinion in 2 points here:

  • As you said the (any) language is already quite confusing, introducing steps that do exactly the same than others would make it worst and until now I have not found any good reason to do it; if you did please comment about it. Moodle core provides a close set of steps, you can always extend the available steps in a 3rd party plugin 
  • We deprecate and/or replace just the necessary as we don't want people that already wrote their scenarios to update them, IMO we could discuss about a should -> do replacement, but should is a valid option and the benefit of replacing it for do is minor when comparing to deprecating steps with should 
In reply to David Monllaó

Re: Acceptance steps of things that do or do not exist

by Itamar Tzadok -

David, please do not assume that Moodle test developers will not be able to understand that

Then "element" "selector" should exist

and

Then "element" "selector" exists

are two phrases for the same step.

Gherkin is supposed to look like natural language (a subset of) and as such it already has some ambiguity. Given, When, Then, And, But are interchangeable, but only most of time.

I'm inclined to think that only people who've taken one too many philosophy courses (I for one wink) would be bothered by the difference between the potentiality in the first and actuality in the second, or even notice it. Others would probably just use one or the other.

Note that I'm not suggesting to deprecate and replace the "should" terminology. Merely to extend the vocabulary. And most importantly, the extension does not require touching the php. Just adding a few more @Given declarations as aliases.

smile