Ruby + selenium-webdriver automate the test step by step ----- preparation, selenium automated test
This series of articles is not about ruby, nor selenium-webdriver, but about how to write automated tests step by using a small example of logging on to the soso homepage. Objective: To implement logic and data separation through object-oriented programming.
If you think you have learned the selenium-webdriver tool, and you can write some small examples by yourself, it seems that you are in the fog and do not know how to write a finished product, you are not sure which development framework to use or what testing framework to use. For example, it seems that you have already gone to the market to buy food, cut the food, and use the kitchen utensils to fire, go back to the pot, and put the oil in place, but you just don't know how to make the food well. The purpose of this series of articles is to show how to make "Dishes ready"
Before getting started, let's talk about how to learn ruby and selenium-webdriver: http://17test.info/
Ruby + selenium-webdriver learning video tutorial: http://www.boobooke.com/goods-37.html
Preparations:
1. ruby
1. Version: 1.92
2.: http://rubyinstaller.org/downloads/ (this address needs to be FQ out, or download somewhere else)
3. installation:
Double-click the installation package to automatically install the package. Check all options during installation.
4. Check ruby installation:
Command Line input:
The following information indicates that the installation is successful:
|
ruby1.9.2p180 (2011-02-18) [i386-mingw32] |
5. Check whether rubygem is installed.
Enter:
6. Update rubygem
Enter:
7. Input again in the command line:
Return: 1.8.24 indicates that the latest version has been updated.
Ii. DevKit
1. Install
Double-click the downloaded 7z file and specify the decompression path. No space is allowed in the path. For example, C: \ DevKit. The path is <DEVKIT_INSTALL_DIR>.
Execute the following command in the command line:
cd <DEVKIT_INSTALL_DIR>
ruby dk.rb init
ruby dk.rb install
|
Please update yourPATHto include build toolsordownload the DevKit from'http://rubyinstaller.org/downloads'andfollow the instructions at'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit' |
You can manually edit the config. yml file and add the ruby installation directory to the config. yml file.
The config. yml file is generated only after the ruby dk. rb init command is executed)
2. verify whether the installation is successful
Enter the following command in the command line:
1 |
gem install rdiscount --platform=ruby |
The result is as follows:
|
Fetching: rdiscount-1.6.8.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed rdiscount-1.6.8
1 gem installed
Installing ri documentation for rdiscount-1.6.8...
Installing RDoc documentation for rdiscount-1.6.8...
|
Iii. selenium-webdriver
1. Install
Enter the following command in the command line:
1 |
gem install selenium-webdriver |
2. verify whether the installation is successful
Enter the following command in the command line:
gem list selenium-webdriver |
The following prompt is displayed:
|
*** LOCAL GEMS ***
selenium-webdriver (2.21.0)
|
Iv. rspec
1. Install
Enter the following command in the command line:
5. Text Editor
: Http://download.csdn.net/detail/janne09/4401925
Source: http://www.cnblogs.com/timsheng/archive/2012/09/13/2683343.html