Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a section to explain declarative vs imperative style (Fixes #323) #429

Merged
merged 9 commits into from
Dec 30, 2019

Conversation

lisacrispin
Copy link
Contributor

Working on fixing #323

Copy link
Member

@mlvandijk mlvandijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lisacrispin - I really love this explanation; I think it captures pretty well what we try to say to users.

A few (minor) comments below.

In addition, some suggestions:

  • let's see if we can make the wording a little more concise?
  • I'd like to add something about imperative steps providing too much detail, making it hard to see what the exact behaviour is that a particular scenario is trying to illustrate. As is decribed in this article

Thanks for taking the time to help out!

content/docs/bdd/better-gherkin.md Outdated Show resolved Hide resolved
content/docs/bdd/better-gherkin.md Outdated Show resolved Hide resolved
content/docs/bdd/better-gherkin.md Outdated Show resolved Hide resolved
content/docs/bdd/better-gherkin.md Outdated Show resolved Hide resolved
content/docs/bdd/better-gherkin.md Outdated Show resolved Hide resolved
Copy link
Member

@mlvandijk mlvandijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lisacrispin - I really love this change! Some minor additional suggestions, mainly for consistency with the rest of the docs. (for example, replacing "tests" with "scenarios").

If you agree with my suggested changes, you should be able to click the "commit suggestion" button below each comment and that will automatically apply the suggestion as a commit.


# Consider a more declarative style

One way to make tests easier to maintain and less brittle is to use a declarative style. Declarative style describes the behaviour of the application, rather than the implementation details. Declarative tests read better as "living documentation". A declarative style helps you focus on the value that the customer is getting, rather than the keystrokes they will use.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
One way to make tests easier to maintain and less brittle is to use a declarative style. Declarative style describes the behaviour of the application, rather than the implementation details. Declarative tests read better as "living documentation". A declarative style helps you focus on the value that the customer is getting, rather than the keystrokes they will use.
One way to make scenarios easier to maintain and less brittle is to use a declarative style. Declarative style describes the behaviour of the application, rather than the implementation details. Declarative tests read better as "living documentation". A declarative style helps you focus on the value that the customer is getting, rather than the keystrokes they will use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


One way to make tests easier to maintain and less brittle is to use a declarative style. Declarative style describes the behaviour of the application, rather than the implementation details. Declarative tests read better as "living documentation". A declarative style helps you focus on the value that the customer is getting, rather than the keystrokes they will use.

Imperative tests are communicative, and in some contexts, this style of test is appropriate. On the other hand, because they are so closely tied to the mechanics of the current UI, they often require more work to maintain. Any time the implementation changes, the tests need to be updated too.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Imperative tests are communicative, and in some contexts, this style of test is appropriate. On the other hand, because they are so closely tied to the mechanics of the current UI, they often require more work to maintain. Any time the implementation changes, the tests need to be updated too.
Imperative tests communicate details, and in some contexts, this style of test is appropriate. On the other hand, because they are so closely tied to the mechanics of the current UI, they often require more work to maintain. Any time the implementation changes, the tests need to be updated too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Why does the 'and' show up in red there? Is that something I need to change also?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. You can ignore it


Imperative tests are communicative, and in some contexts, this style of test is appropriate. On the other hand, because they are so closely tied to the mechanics of the current UI, they often require more work to maintain. Any time the implementation changes, the tests need to be updated too.

Here's a more imperative style:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Here's a more imperative style:
Here's an example of a feature in an imperative style:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, and next one I will try to do the "commit changes" thing in the dropdown. Doh.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Learn something new every day ;)

content/docs/bdd/better-gherkin.md Outdated Show resolved Hide resolved
@mlvandijk mlvandijk changed the title WIP: Add a section to explain declarative vs imperative style WIP: Add a section to explain declarative vs imperative style (Fixes #323) Dec 29, 2019
lisacrispin and others added 2 commits December 30, 2019 09:46
Co-Authored-By: Marit van Dijk <mlvandijk@gmail.com>
@lisacrispin lisacrispin changed the title WIP: Add a section to explain declarative vs imperative style (Fixes #323) Add a section to explain declarative vs imperative style (Fixes #323) Dec 30, 2019
lisacrispin and others added 2 commits December 30, 2019 09:55
Co-Authored-By: Marit van Dijk <mlvandijk@gmail.com>
Co-Authored-By: Marit van Dijk <mlvandijk@gmail.com>
lisacrispin and others added 2 commits December 30, 2019 10:03
Co-Authored-By: Marit van Dijk <mlvandijk@gmail.com>
Co-Authored-By: Marit van Dijk <mlvandijk@gmail.com>
Copy link
Member

@mlvandijk mlvandijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great content! Thanks @lisacrispin

@mlvandijk mlvandijk merged commit 132ae6f into cucumber:master Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants