Test Automation Begin with Selenium RC C#

1. Download Selenium IDE Add-On  from  http://seleniumhq.org/download/

2. Download Selenium RC from http://seleniumhq.org/download/ and extract the folder.

3. Install JAVA, Visual Studio 2008, NUnit

4. Installing Selenium RC:

Installation of Selenium RC

After downloading the Selenium-RC zip file from the downloads page, you’ll notice it has several sub-folders. These folders have all the components you need for using Selenium-RC with the programming language of your choice.

Once you’ve chosen a language to work with, you simply need to:

  • Install the Selenium-RC Server.
  • Set up a programming project using a language specific client driver.

Installing Selenium Server

The Selenium-RC server is simply a Java jar file (selenium-server.jar), which doesn’t require any special installation. Just downloading the zip file and extracting the server in the desired directory is sufficient.

Running Selenium Server

Before starting any tests you must start the server. Go to the directory where Selenium-RC’s server is located and run the following from a command-line console.

java -jar selenium-server.jar

This can be simplified by creating a batch file (.bat) containing the command above. Then make a shortcut to that executable on your desktop and simply double-click the icon to start the server.

How to create the Batch file to run Selenium server:

-Open Notepad and type the syntax as mentioned below:

cd [ABSOLUTE PATH OF THE SELENIUM-SERVER FOLDER]

e.g. [C:\Program Files\selenium-remote-control-1.0.3\selenium-server-1.0.3]

java -jar selenium-server.jar

pause

NOTE: For the server to run you’ll need Java installed and the PATH environment variable correctly configured to run it from the console. You can check that you have Java correctly installed by running the following on a console:

java -version

Run selenium batch

Add References to project

Select all dll from selenium unzip location (i.e. \selenium-remote-control-1.0.3\selenium-dotnet-client-driver-1.0.1)

Now Finally Selenium ready for the Test

Set up NUnit with Visual Studio 2008 to run Tests

Creating your first NUnit test

Now we need to create a new project to test if this works, and we need to add a reference to NUnit to be able to use the code.

Click “Project > Add Reference…”

Select “Browse” and navigate to “C:\Program Files\NUnit 2.4.8\bin” and select the nunit.framework.dll

How to run the NUnit GUI runner from within Visual Studio C# Express 2008

Visual Studio C# Express allows you to define outside “Tools” which can be run from the menu.

Click on “Tools > External Tools…” to add NUnit’s GUI Runner.

To run N Unit from VS2008 Tools > NUnit

Advertisements

About samp79

Professional Automation Tester
This entry was posted in Selenium, Test Automation. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s