【转载】
Hi All,
In this article I will tell you how you can install and use Selenium RC(the best open source web testing tool and multi browser testing). I have been using Selenium RC for a while now and found it very useful to test web based applications. I have found that there is no installation and user guide for Selenium RC.
First download selenium-remote-control-1.0-SNAPSHOT i.e. the nightly build from the http://seleniumrc.openqa.org/download.html. There is some issue with Version 1.0 beta 1 (run time error when running on IE browser).
This is a zip file so, unzip the file and save it in ur c drive (Folder selenium-remote-control-1.0-SNAPSHOT). Create a folder called Seleniumin your c drive and a sub folder called tests in c:\Selenium. Save all you selenium scrīpts in C:\Selenium\Tests\.
Before runing first thing is close all Firefox browser windows and follow the instructions given below.
Open the Windows "Start" menu, select "Run" (on Windows Vista, use "Start Search" or enable the Run box, as described here) then type and enter one of the following:
* firefox.exe -profilemanager
* firefox.exe -P
For more details go to http://kb.mozillazine.org/Profile_Manager
When creating the profile manager you will have to create it under a new folder C:\Firefoxselenium.
Once the profile manager is created you will have to create two batch file (.bat); one for IE and the other for Firefox.
This is an example of the SeleniumFirefox.bat file.
cd
\ cd C:\selenium-remote-control-1.0-SNAPSHOT\selenium-server-1.0-SNAPSHOT
java -jar selenium-server.jar -port 4545 -firefoxProfileTemplate C:\Firefoxselenium -htmlSuite chrome http://www.yourtestwebsite.com// C:\selenium\G_alltestff.html* C:\selenium\*Results.html*
pause
This is an example of the SeleniumIE.bat file.
cd
\ cd C:\selenium-remote-control-1.0-SNAPSHOT\selenium-server-1.0-SNAPSHOT
java -jar selenium-server.jar -port 4545 -htmlSuite iehta http://www.yourtestwebsite.com// C:\selenium\G_alltestie.html* C:\selenium\*Results.html*
pause
Next step is to create G_alltestff.html (For Firefox)
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Test Suite</title>
</head>
<table id="suiteTable" cellpadding="1"
cellspacing="1"
border="1"
class="selenium">
<tbody>
<tr><td><b>Test Suite</b></td></tr>
<tr><td><a href=".\Tests\Name of you selenium scrīpt.html">Name of the scrīpt</a></td></tr>
</tbody>
</table>
</body>
</html>
Next step is to create G_alltestie.html (For Firefox)
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Test Suite</title>
</head>
<table id="suiteTable" cellpadding="1"
cellspacing="1"
border="1"
class="selenium">
<tbody>
<tr><td><b>Test Suite</b></td></tr>
<tr><td><a href="C:\Selenium\Tests\Name of you selenium scrīpt.html">Name of the scrīpt</a></td></tr>
</tbody>
</table>
</body>
</html>
Once you have done this you are all set to rock and roll. To run Selenium RC on Firefox double click on SeleniumFirefox.bat file and to run Selenium RC on IE double click on SeleniumIE.bat. Selenium RC is a very useful tool and I feel it’s very stable that Selenium IDE.
I would also like to thank my colleague Wedi Wun for helping me write the Selenium RC installation and user guide.To know more about Selenium RC/IDE Data driven testing see my article Data Driven Selenium using Excel Macros.
Cheers
Pavan Puddupakkam