How to write a test plan


Gherkin and .feature file

yascribe uses the Gherkin format and the .feature file of the
Behaviour Driven Development approach.

A test plan is defined in the .feature file as follows :

  • the test plan is the unique Feature of the .feature file
  • scenarios of the test plan are defined by Scenario blocks of the unique Feature
  • scenarios will be run sequentially in their order inside the Feature
  • actions and assertions of a scenario are defined by steps of the Scenario block
  • steps will be run sequentially in their order inside the parent Scenario

Create in your test project a .feature file where you write scenarios of your test plan. Here is an example :

Feature: Consulting yascribe documentation 

  Scenario: Go to yascribe site
    When I navigate to "https://yascribe.com/"
    Then "A codeless testing tool" is displayed

  Scenario: Displaying "How to write a test plan" page
    When I click on "Documentation"
    And I click on "Writing a test plan"
    Then "How to write a test plan" is displayed

Step Action

A step action is a single action. It begins by one of the keywords WhenAnd* followed by the phrase that defines the action. For example :

When I enter "Paris" into "Destination"

By default, yascribe understands basic pre-learned actions (like enter) that are listed in the “Actions” documentation.

But yascribe can learn new actions and new phrases thanks to the self-learning mechanism described in the “Self-learning” documentation.

Step Assertion

A step assertion is a single assertion. It begins by one of the keywords `Given`, `Then`, `But`, `*` followed by the phrase that defines the assertion. For example :

Then "Welcome in Paris" is displayed

The passive and active forms of the verb can be used. The active the sentence above is :

Then the page displays "Welcome in Paris"

The negative form is also available :

Then "Welcome in Tokyo" is not displayed

By default, yascribe understands basic pre-learned assertions (like display) that are listed in the “Assertions” documentation.

But yascribe can learn new assertions and new phrases thanks to the self-learning mechanism described in the “Self-learning” documentation.

Specify a value in a phrase

A value in a phrase must be double-quoted. For example: "Paris".

Specify an element in a phrase

An element is identified by its double-quoted value and by its type. For example the following “Open file” button :

To click on the button, the following phrases can be used :

When I click on "Open file"

or with the button type :

When I click on "Open file" button

The double-quoted value that identifies the button is the label “Open file”. Some time an element has not any displayed label, in this case a html attribute (aria label or id for example) of the element will be used instead of the label.

The type of the button can be specified to differentiate the “Open file” button from another element that has the same label “Open file”.

The default pre-learned element types are listed in the “Element types” documentation.

Adding the group of the element is another manner to differentiate an element from others. For example :

To click on the “Bold” button of the second group, the following phrase will be used :

When I click on "Bold" of "Legacy appearance"