Tuturial_eng - adessoCucumber/Cucumber GitHub Wiki

Login

There are two different login credentials needed - your GitHub-Username and the associated Github-Account-Token.

If you haven't created a "personal access token already, you can create it under Settings-> Developer Settings-> Personal access tokens-> Generate new token. You have to select which permissions the Token is supposed to grant. To use the Seed-Test-App you don't need any extra permissions however.

Imgur

After entering your username and token you can log in to the Seed-Test-App.

Imgur

Selecting your repository

As soon as you logged in successfully you can select the repository you want to use from the appearing list.

Imgur

Creating a story

Seed-Test lets you create Stories for your iwn tickets / issues. Therefore you have to create an issue in your repository first. Then create and assign a label named "story" to your issues, that you want to write tests for. This marks them for Seed-Test.

![Imgur](https://i.imgur.com/puyTZXu.png =750x)

![Imgur](https://i.imgur.com/IdJRFaU.png =750x)

![Imgur](https://i.imgur.com/yFplqSs.png =750x)

Creating/Editing/Deleting scenarios

After completely configurating your issues, you can create scenarios in the Seed-Test-App. Therefor you can unfold a list of scenarios for each story on the left side. If there's no existing scenario, you can create a new one using the "+"-Button. After you created a scenario, you can select it in the list appearing beneath the previously mentioned button.

Imgur

You can delete scenarios, edit their title ("Pen"-Button next to the scenarios name), change the background of the story (-> explanation in chapter "Advanced") and most important: edit/fill the Given/When/Then-Elements. Each Given/When/Then-Element has multiple options to configure it. You can find them by clicking the "+"-Button on the far right side of each element. As soon as you click the button, a small window appear beneath the button, which provides you with different selection options.

The following list is supposed to give you explanations of the individual elements, a list of all the selection options and examples on how they look like:

  • Given:

    • Indicates an Pre-Condition

    • Options: Role/Website

    • Examples: “As a XY”, “I am on the website: XY”

  • When:

    • Indicates a Action

    • Options: Website/Button/Field/Radio/Dropdown/HoverOverAndSelect/Checkbox

    • Examples: “I go to the Website: XY”, “I click the button: XY”

  • Then:

    • Indicates a Post-Condition / Result

    • Options: Website/Text

    • Examples: “So I will be navigated to the website: XY”, “So I can see the text XY in the textbox: XY”

Imgur

As soon as you have created the elements and correctly filled in the information needed, you can click the "Save"-Button again to save your changes.

Performing tests and storing test data

Since you now have created a scenario, you can perform tests for it. You can do that by clicking the "Run Tests"-Button, which you can find directly beneath the "Example"-Panel. As soon as you press the button tests using your set specifications (given/when/then) will be carried out. As soon as all steps are finished, the results will be shown to you in an overview.

Imgur

Furthermore you can read through all the metadata and, by using the "Features"-Panel, look into all errors that happened and their associated error messages.

Imgur

Next to the "Run Tests"-Button there will now be two other buttons you can click, the "Arrow"-Button, which you can use to close the "Test Result"-Panel and open it up again, and the "Download"-Button, which you can use to download the test results.

Furthermore you have the opportunity to run tests for all the scenarios you created at once. Therefor you can use the "Run Story"-Button. This works the same as testing a single scenario. You can now find a list of all tested scenarios in the "Feature"-Panel and examine each one for error messages. You can download these results by using the "Download"-Button, too.

Advanced

In this chapter you can find useful actions you can use in addition to the main actions.

  • Background:

    • You can use the background to set actions, which will be carried out before testing the whole story. This happens before the test runs through the Given/When/Then-Steps and is used across all scenarios. In short: A background allows to set Given-Steps used for all scenarios.

    • Example:

    Imgur

  • Examples:

    • For using examples, you have to create placeholders in your Given/When/Then-Steps. You can assign values to the placeholders, which will be used instead of them. You can assign more than one value. If there is more than one value assigned, the whole test will be run as often as there is a value that hasn't been used once. Each test case created by this will be carried out individually and independent.

    • Example:

    Imgur

Useful links

In this chapter you can find useful links for solving upcoming problems.

Gherkin Reference

Introduction to BDD

Cucumber Dokucumentation