Selenium Old

selenium

We should be able to launch the test runner easily via a URL (bookmarked) and see the result in the browser. We should be able launch the test from Eclipse and have it run in a headless environment.

Test dependency
Data Driven
Ability to use Selenium IDE to record the tests
Ability to generate unique data
Grouping of test cases
Custom place holders (externalize configuration and data)
Data driven tests - execute same test with multiple datasets.

Application Configuration, GUI Map, Data Map
UI Objects, SeleniumHelper, Util, Data Generator

Ability to label a test case as dependent on another test case.
Ability to run test cases using data driven testing.

We need something that allow users to manage test cases that were recorded by Selenium IDE. Ideally, this should be integrated into Selenium IDE itself. The user should be able to record test cases, store these test cases in common location under version control (subversion, maybe via TurtoiseSVN), be able to search for test cases by name or description. Ability to use a folder structure to group related test cases. Ability to specify that this test case depends on other test cases. On the server side, we should be able to checkout from subversion, scan this directory, organize these test cases according to test dependency order, execute these test cases in parallel using Selenium RC or WebDriver.

Selenium allows us to add our own custom commands.

Define application specific settings (application URL, browser)
Define UI elements map

TestNG:
http://marcovaltas.com/2009/02/19/running-selenium-with-testng.html
http://selftechy.com/2012/01/15/testng-test-automation-with-selenium
http://testng.org/doc/selenium.html
http://stackoverflow.com/questions/1149080/how-to-get-selenium-and-testng-to-open-one-browser-to-run-tests-in-multiple-clas

Google Test Analytics:
http://code.google.com/p/test-analytics/
http://code.google.com/p/test-analytics/wiki/AccExplained
http://googletesting.blogspot.com/2011/10/google-test-analytics-now-in-open.html
https://test-analytics.appspot.com
http://devblog.xing.com/qa/risk-based-test-planning-with-google-test-analytics/

There is a #selenium channel

Selenium is hosted on Google Code: http://code.google.com/p/selenium/ which has an issue tracker: http://code.google.com/p/selenium/issues/list

WebDriver
selenium user group
http://www.scribd.com/doc/11480981/Extensible-Selenium-Framework

Selenium is a framework to automate functional ( UI ) testing of web application. Selenium is maintained by openqa.org, and I also maintain a separate branch at http://code.google.com/p/selenium-fasttrack/

What is data-driven testing?
How to get Selenium IDE integrated with Selenium RC?
Test Dependencies

http://www.telerik.com/campaigns/teststudio/aw/5-hidden-selenium-costs
http://www.sitepoint.com/using-the-selenium-web-driver-api-with-phpunit/

http://www.ibm.com/developerworks/rational/library/run-automated-selenium-junit-tests/
http://assertselenium.com/2012/10/28/how-to-setup-a-webdriver-project-in-eclipse/
https://wiki.eclipse.org/RapUITesting
http://www.wunderkraut.com/blog/creating-and-running-a-simple-selenium-webdriver-test/2011-09-15
http://www.aptude.com/it/easyblog/entry/selenium-test-automation-configuring-selenium-rc-for-eclipse
http://stackoverflow.com/questions/18492668/how-to-execute-a-selenium-test-in-java
http://docs.seleniumhq.org/docs/appendix_installing_java_driver_client.jsp
http://www.youtube.com/watch?v=4XDzJpQT0EQ
http://www.softwaretestingclub.com/profiles/blogs/selenium-2-0-webdriver-how-to-configure-selenium-webdriver-in
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=6&cad=rja&uact=8&ved=0CE0QFjAF&url=https%3A%2F%2Fwww.ibm.com%2Fdeveloperworks%2Fcommunity%2Ffiles%2Fform%2Fanonymous%2Fapi%2Flibrary%2Fa82c60c3-d3d9-4444-9f9f-63678cf12c17%2Fdocument%2F4c776caa-dd5a-40aa-88fe-5b311d1093e4%2Fmedia%2FSelenium%2520with%2520TESTNG%2520and%2520eclipse%2520IDE.pdf&ei=oPJnU6CjDM3qoAS0u4DoBg&usg=AFQjCNGl_24qX-GwhRetLu9bmE0q95IvGQ&bvm=bv.65788261,d.cGU

http://net.tutsplus.com/tutorials/php/how-to-use-selenium-2-with-phpunit/
http://net.tutsplus.com/tutorials/tools-and-tips/get-test-infected-with-selenium-2/

http://www.youtube.com/watch?v=KL4Y7cWiK4g Data Driven Testing using Selenium & TestNG Part 1 of 4

http://functionaltestautomation.blogspot.com/2009/10/dataprovider-data-driven-testing-with.html

Selenium has several components:

Selenium Core is the base component which consist of the execution loop, a library of commands, and can be extended by adding userExtensions=… parameter. Selenium Core is implemented in JavaScript.

Selenium RC is a Java-based server. It has a nice hook for launching browsers, terminating browsers. It listens on a TCP socket. There are client libraries for PHP, Perl, Java, etc. More on Selenium RC

Selenium IDE is plugin for Firefox. At of November 8th 2008, it is primarily a test recorder. It allows user to interactively record the test, and play back. Selenium IDE is still fairly limited, but it seems that more features are being added. I hope that some day it will integrate with source control so that test script and test data can all be seamlessly checked into source control, and therefore better support for sharing between testers. Selenium IDE also has a TestRunner mode, and it is the primary mode that we used. Being a plugin to Firefox, it allows us to overcome security restrictions. We can have multiple window opened each fetch page from different domain. We can start testing one domain, and switch to another domain. We can test iframe that load content from different domain. In our particular case, our application was tightly integrated with Salesforce.com so our script need to have both Salesforce.com window opened, and our application window opened at the same time.

Selenium HTA is for testing with Internet Explorer. It gives us ability to overcome some security restriction.

Selenium Grid is for running Selenium on a grid or a cloud of nodes (Amazon EC2)

Selenium and TestNG

To use javascript variable as an argument to selenium command:

javascript{seleniumApplicationURL}

Selenium Code
WebDriver

UI_Element is available in SeleniumIDE as a user extension.

selenium.type("txt_Lgn","bob");

becomes

selenium.type("ui::Signinpage::TextboxLogin()","bob");

If the id got changed from txt_Lgn to txt_Login, we only need to change this in one place. Sample UI Map file:

var myMap = new UIMap();
myMap.addPageSet({
    name: 'SignInPage',
    description: 'My App Sign In Page',
    pathRegexp: '.*'
});
myMap.addElement('SignInPage', {
    name: 'UserNameTextBox',
    description: 'UserName Text box',
    locator: '...'
});

This file has to be created as a JavaScript file with the .js extension. Open SeleniumIDE, select Option -> Options. Under Selenium Core Extensions (user extension.js), browse the above UIMap.js file and click OK. Close SeleniumIDE and reopen it to get the UIMap activated.

How to use Seleinum with JUnit / TestNG for data driven testing?

  1. Launch Eclipse
  2. Create a new workspace if necessary (File -> Switch workspace -> Other. Click the Browse button and create a new folder)
  3. Create a new Java project (File -> New -> Project -> Java -> Java Project)
  4. Create a new lib folder to contain all JAR files

Download selenium-server, selenium-java, -client, -driver from seleniumhq.org/download/
Download TestNG from testng.org/doc/download.html
Download jxl
Download JUnit

TestNG plugin for eclipse

Right click on the project -> Properties -> Java Build Path -> Add JARs

Create a folder name "tests" which is a source folder.
Create a package

Add test data files

Create a folder where we can keep all test data files. We can call this folder "resources/data"
Create a test data file (excel file)

http://code.google.com/p/tseng/
http://qaselenium.blogspot.com/
http://qaselenium.blogspot.com/2011/05/selenium-data-driven-using-properties.html
http://qaselenium.blogspot.com/2011/04/how-to-handle-https-and-security-popups.html

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License