C# .NET - hot to integrate selenium rc to vs2008

Asked By abinav shankar on 04-Jan-12 09:52 AM


I want to use selenium Rc for executing the testcases in IE and i want to know how it can be done using Visual studio 2008


dipa ahuja replied to abinav shankar on 04-Jan-12 10:20 AM
  1. Download a copy of the http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en.
  2. Register the new service “SeleniumRC”
    "C:\Program Files\Windows Resource Kits\Tools\instsrv.exe" SeleniumRC
    "C:\Program Files\Windows Resource Kits\Tools\srvany.exe" -a [myuser] -p [mypass]
  3. Edit your registry to include the path of your Selenium RC installation and executable:
    Windows Registry Editor Version 5.00
    "AppDirectory"="C:\\Program Files\\selenium-server-1.0.1"
    "AppParameters"="-Xrs -jar selenium-server.jar"
  4. Now that you have the Selenium RC service created, go to Administrative Tools > Services and start the service. Check the system event logs for errors to ensure everything is working properly.



[)ia6l0 iii replied to abinav shankar on 04-Jan-12 10:30 AM
That should be easy: 

Visual studio is only used to create an assembly for the selenium test script that Nunit can use.

Follow these steps:

a) Install the prerequisties - along with Selenium RC. This includes JRE (Java runtime environment), NUnit, and Selenium IDE plugin for FireFox. 
b) After installation - Launch the Selenium IDE plugin.
c) Open the page that you want to be tested in Firefox 
d) Do your UI movememts on the page that loads. 
e) The actions are recorded in the Selemium IDE.) 
f) Stop Recording. The steps are all captured. 
g) Choose Format from the Options menu. And "C#" as the format.
h) This gives you C# code.

Open Visualstudio and create a project. Create a class file and place this code. 

Note that you now need to add references to the Selenium and Nunit libraries 
a) Nunit.core dll
b) Nunit.framework.dll
c) Thoughtworks.Selenium.*.* dll's

Compile the project and create an assembly.

Start the Selenium RC Server using the java command:
java -jar pathToTheSelemiumServerJarFile

Launch the Nunit program and open the compiled assembly above.

Click "Run" to run the test.

That's it.

kalpana aparnathi replied to abinav shankar on 04-Jan-12 02:44 PM