First, environmental installation
1. Ruby Installation
: HTTPS://YUNPAN.CN/CP4SSPDGRTPBW access Password 2473
We are now using ruby193, can be directly copied to use, the Ruby installed directory under the Bin directory configuration to the environment variable path, open the command line input ruby–v to see if the installation is successful;
2, Installation Devkit
: Https://yunpan.cn/cP4S3Min4YeTq access Password 3858
Ibid can directly copy our Dev installation directory, into the Extract directory D:\Dev, run Ruby DK.RB Init initialization operation, and then run the Ruby dk.rb install to complete the installation, the Dev directory under the bin directory configuration to the environment variable under path;
3, installation cucumber
If it is a direct copy of ruby193, you open the command prompt input gem list can see Cucumber has been installed;
If not you can also be installed online, gem install cucumber can install the latest version of the Cucumber;
4, Installation WATIR-WEBDRIVR
Ibid. if it's a direct copy, open the command prompt and enter the Gem list to see if the Watir-webdriver is already installed.
If no installation is installed at the command prompt, enter gem install Watir-webdriver to install the latest version of Watir-webdriver.
Ii. use of the Cucumber+watir+ruby framework
First build a directory structure that creates a features folder, as shown:
Under the features directory, create a new wt_login.feature
# Encoding:utf-8
Feature:my_login Feature
Scenario:login_wsyyt
When I login Wsyyt
Executive Test.feature
Modify Marketplace Login Script according to Cucumber generated RB format
# Encoding:utf-8
When (/^i login wsyyt$/) do
Require ' watir-webdriver '
Mallloginpage = Watir::browser.start ' http://ah.10086.cn/mall/login.shtml '
Mallloginpage.text_field (: ID, "LoginName"). Set ("15156889837")
Mallloginpage.text_field (: ID, "Smsvalicodeinput_"). Set ("112233")
Mallloginpage.checkbox (: ID, "Licensechk_index"). Set "On"
Mallloginpage.link (: Title, "Login"). Click
End
Execute file:
Cucumber Framework Implementation Report
Watir-webdriver User Manual