Selenium is the most popular open source web application testing tool. I mainly studied selenium RC, using Java, development tools eclipse, and JUnit.
Development Environment preparation:
1. Install JRE or JDK;
2. Install eclipse;
3. Download The JUnit package;
4. Install Firefox and plug-ins selenium IDE, firebug, and XPath checker;
5. Download selenium RC and decompress it.
Related links:
JRE or JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Eclipse: http://www.eclipse.org/
JUnit: http://www.junit.org/
Selenium official address: http://seleniumhq.org/
Firefox: http://www.mozilla.com/
Firebug: https://addons.mozilla.org/en-US/firefox/addon/1843/
XPath Checker: https://addons.mozilla.org/en-US/firefox/addon/1095/
C # a simple example of developing a selenium test script:
In vsts2010, create testproject and introduce selnium DLLs related to the selenium-dotnet-client-driver-1.0.x Folder: thoughtworks. Selenium. Core. dll, thoughtworks. Selenium. integrationtests. dll, thoughtworks. Selenium. unittests. dll
Insert the following code in unittest1.cs:
Using system; <br/> using system. text; <br/> using system. collections. generic; <br/> using system. LINQ; <br/> using Microsoft. visual Studio. testtools. unittesting; <br/> Using selenium; </P> <p> namespace testproject1 <br/>{< br/> [testclass] <br/> public class unittest1 <br/>{< br/> [testmethod] <br/> Public void testmethod1 () <br/>{< br/> iselenium sel = new defaultselenium ("localhost", 4444, "* iexplore", "http://www.google.com.hk/"); <br/> SEL. start (); <br/> SEL. open ("/"); <br/> SEL. windowmaximize (); <br/> SEL. type ("Q", "Selenium"); <br/> SEL. click ("btng"); <br/>}< br/>}
Starting selenium server: Java-jar selenium-server.jar from the command line
Run the test code and write a test script in C # + selenium RC mode.
Next, we will take the qtp classic learning test website http://newtours.demoaut.com/index.php as an example to learn how to write a test script for java?selenium RC.