A recent post on stackoverflow raised the question which tools to use for automated tests of web applications.
This question has been an interesting issue for me, as the largest web application I develop and maintain has over the years grown to some 300 aspx files.
Required software to implement tests using Selenium and NUnit:
- Selenium IDE plugin for Firefox (1.5 or later)
- Selenium Remote Control
- NUnit .Net testing framework
Selenium Remote Control consists of an HTTP server component requiring Java (1.5 or higher) and a .Net client library. Method calls to the library issue commands to the Selenium server, which in turn sends these commands to the browser.
First, install Selenium IDE plugin for Firefox. You can use the IDE to record your actions in the browser, and replay these recorded actions. It also generates scripts of the recorded actions (called Test Cases) in HTML, C#, and other programming languages.
After installing Selenium Remote Control, the Selenium HTTP server can be started using the command line
c:\path\to\java.exe -jar c:\path\to\selenium-server.jar
Selenium server listens on port 4444 by default.
Install NUnit and create a Visual Studio project which references the nunit.framework.dll and Thoughtworks.Selenium.Core.dll libraries. Your project is now ready to compile the test cases generated by Selenium IDE.
(I recommend changing the browser string in the DefaultSelenium constructor to “*iexplore” for first experiments)
Run the NUnit GUI application and open the newly created assembly. The left-hand tree shows assemblies, namespaces, and test case names.
After starting the Selenium server, select a node and press Run. This will open a browser window which executes the commands defined in the test case. After completion, the browser will be closed again. (If you don’t see a browser window, use task manager to watch the list of processes)
Posted by devio
Posted by devio
Posted by devio