Java, Selenium, Cucumber : Automatical creation of cucumber feature file
Автор: ExampleCodes
Загружено: 2021-04-30
Просмотров: 38
Описание:
This programm shows, how to create Cucumber Feature file in an automated way.
As an example, creating feature file for logging into Facebook is presented.
A Feature file for logging into Facebook looks like :
Feature: User loads Facebook page and logs in
Scenario: User logs in successfully
Given User is on Facebook page
When User fills Email field with value
And User fills Password field with value
And User presses Login button
Then User logs into Facebook page
At the running application :
1. The Facebook website loads
2. A small grey colour Java window appears. It handles specific mouse movements (right click, double left click).
The logic of the application :
1. There are 2 modes (change between them with mouse right click on the Java window):
a. Selecting mode : when clicking with left mouse button, the web element locators are read and written to Feature file
b. Operational mode : the user types Email address, Password and press Login Button. At this time no locators are read
The Email address is accidentally typed incorrectly a few times, but that is not recorded in the Feature file, as the mode is "Operational mode".
2. Cucumber keywords written into the Feature file :
Scenario, Feature, Given : static texts, written by the application as default
When, And, Then : written according to mouse presses
Sequence of "When", "And", "Then" : "When" is the first every time, and there is only one "When". After "When", there are
multiple "And" keywords, until mouse left button is double pressed on the Java window. That starts the next line with "Then".
The automatically created result is :
Feature: User loads Facebook page and logs in
Scenario: User logs in successfully
Given User is on Facebook page
When User fills 'email' with value
And User fills 'pass' with value
And User presses 'royal_login_button'
Then User logs into Facebook page
One can see, that the correct locators are read from the Website, and the sequence of When, And, Then follows the logic.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: