Table of Contents
- Inside the script editor section, scripts can be added, edited and deleted from the projects.User can also access their environment file from this section.
- There are two way to add script file in project:-
- By right click on the project in which the user wants to add a script.
- By clicking on the “+” icon present on the right side.
By using any one of the options you can add a script file. Users can also provide a path(folder name) to their script file.
Users can also upload the script from their system directory.
- There are two way to add multiple script file
- By right click on the project in which the user wants to add a script and select option ‘upload multiple script from selected folder’.
- By right click on the project in which the user wants to add a script and select option ‘Copy script file from another project’.
- All the scripts will be displayed under that project folder based on folder structure
- Users can also execute their script, rename their script and delete their script by right clicking on the script and selecting the appropriate option.
- Each script file consists of gherkin language used in the BDD framework for automation as shown below.
- Feature name and script name must be the same.
- There are five types of browser (Chrome, FireFox, Edge, Opera, Safari) on which users can execute their scripts.
- Below are some of the script editing tool icons
To view all the recently opened scripts | |
To increase text size | |
To decrease text size | |
To enable minimap | |
To run current script | |
To save current script | |
To delete current script | |
Open element file | |
To save as current script | |
To uncomment the line | |
To create custom scenario |
- Environment files related to the script can be opened on the right hand side of the script editor. Users can also edit the application file and element file from this section.
- Use the open element file icon present on the top left corner to open environment files related to the script currently opened in the script editor.
Generic rules to write Test Scripts #
- The first line of this file starts with the keyword Feature: followed by a name. It’s a good idea to use a name similar to the file name.
- The second line is a brief description of the feature. It can be preceded by #
- Scenario are the test cases and defined by Scenario: keyword which is a concrete example illustrating how the software should behave.
- Steps in test cases are always preceded by the Given, When, And and Then keyword.
- Scenario name should not consist of the same name and should not include single quotes ‘.
- Every ‘Scenario Outline:’ must have ‘Examples:’
- ‘Examples:’ are always followed by data tables of variable mentioned in script
- Tagging is allowed in scripts with use of ‘@’
- Feature, Scenario and Scenario Outline can be tagged in the line above its declaration
- Only one feature is allowed in one feature file
- Multiple scenarios and scenario outlines are allowed in script
- Examples should be followed by data tables only
- Commenting is allowed using ‘#’.
- The primary keywords are
Feature
Given, When, Then, And - There are a few secondary keywords as well
| (Data Tables)
@ (Tags)
# (Comments)
Note: For More Information, please go to this link : https://cucumber.io/docs/gherkin/reference/ .