Selenium Server 2.0

来源:互联网 发布:货车拉货用什么软件 编辑:程序博客网 时间:2024/05/22 15:43
 
This page gives you step by step directions to set up Selenium Server 2.0, create a suite, and run suite by triggering the Selenium Sever instance using a batch file..

Software needed (will be covered in the steps below):
Selenium Server 2.0 -  http://seleniumhq.org/download/ 
Java JRE -  http://www.oracle.com/technetwork/java/javase/downloads/jre-6u25-download-346243.html 

1. Go to http://seleniumhq.org/download/

2. Download (most current) Selenium Server 2.0 (selenium-server-standalone-2.17.0.jar), and save it in C:\ directory on your computer:


3. Download Java JRE:
http://www.oracle.com/technetwork/java/javase/downloads/jre-6u25-download-346243.html

4. Once Java is downloaded, open cmd and run java -version, it should read:


5. Then in C:\ run java -jar selenium-server-standalone-2.17.0.jar

Output should look something like this:


6. Do Ctrl + C to stop it.

7. Now record some tests which you can use to create a Selenium Server suite.  Use Selenium IDE to record some tests.

Install Selenium IDE at:
http://seleniumhq.org/download/

8. Once Selenium IDE has been downloaded restart FireFox and clickTools > Selenium IDE.  Selenium IDE will open, record some tests using the Selenium IDE recorder and save the test in a folder. Example -C:\Selenium\admin_links_and_tabs.html

9.  Then open NotePad and create a Selenium Server Test Suite using the path to the Selenium IDE recorded tests and save file as .html in C:\Selenium.  Us this format

<table >
<tr>
<td>Admin tests</td>
</tr>
<tr>
<td><a href="admin_links_and_tabs.html">Verifies admin tabs and links</a></td>
</tr>
<tr>
<td><a href="admin_create_advertiser.html">Creates a new Adverstiser</a></td>
</tr>
</table> 

10. Save the Selenium Server Test Suite file as .html. Example - SS_FF_General_Tests.html


11. Open another NotePad and create a Batch (.bat) file that will run your suite:

cd \
ava -jar selenium-server-standalone-2.17.0.jar -trustAllSSLCertificates -multiwindow -htmlSuite "*firefox3" "https://lsjdev.cloudapp.net" "C:\Selenium\TG\General\SS_FF_General_Tests.html" "C:\Selenium\TG\General\RC_RUN_RESULTS.html"

Let's examine this:
  • cd \ - This puts the user in the C:\ directory where selenium-server-standalone-2.17.0.jar lives.
  • java -jar selenium-server-standalone-2.17.0.jar - This starts the Selenium Server much like in step 5 of this document.
  • -trustAllSSLCertificates - This command gets around using a SSL (https) Certificate. 
  • -multiwindow -htmlSuite - This makes it so tests can be viewed in 2 windows, 1 which shows the tests executed, and 1 that show the tests running in the UI.
  • "*firefox3" - This is the browser you want the tests ran in.  SeeBrowser Options section for all browser calls.
  • "https://lsjdev.cloudapp.net/" - This is the Base URL, or the URL you want the tests ran against.
  • "C:\Selenium\TG\Admin\SS_Admin.html" - This is the path to the suite you want to run. You will need to change this to reflect where your suite is stored.
  • "C:\Selenium\TG\Admin\IE_RC_RUN_RESULTS.html" - This is where you want test results sent to on your computer after test are finished.
12. Save this file as .bat on your Desktop - Example TGRegression.bat

13. Go to Desktop and double click the .bat file.
 
 Browser Options - These options can be used to run Selenium tests in different browsers.  The Browsers in bold are the ones I tested.

*firefox
 *mock
 *firefoxproxy
 *pifirefox
 *chrome
 *iexploreproxy
 *iexplore
 *firefox3
 *safariproxy
 *googlechrome
 *konqueror
 *firefox2
 *safari
 *piiexplore
 *firefoxchrome
 *opera
 *iehta
 *custom
原创粉丝点击