JAX 2007: Testing with Selenium (Neal Ford, Thoughtworks)

Origins

"Teflon-Effect": Thoughtworks Time and Expenses System (with Plone). Mercury testing suite (element Selenium protects from Mercury toxity).

Acceptance Testing Tool. Test runs directly in the browser, analysing the DOM. BrowserBot -takes commands and exercises the app as if it was the user.

http://selenium.houghtworks.com

http://www.openqa.org/selenium

Usage

Modes:

TestRunner -put core alongside the app (means static HTML dir).

RemoteControl ("driven mode").

Test cases: Simple HTML tables

| Ignored |

Command | Target | Value

Command | Target |  

Assertion | Expectet | Actual

TestSuites possible.

Understands everthing that can be done by the user and additionally things like changing cookie values.

Concepts

Locators: Find things on the page. id, name, identifier, dom=JS expression

Matching Patterns: glob:pattern, regexp, exact, default is glob

Select: label, value, id, index

Actions: Action, actionAndWait, open

Assertions: Assert, Verify (continue the test in case of a failure), waitFor (e.g. for AJAX – wait until field changes the value)

assertConfirmation: JS confirmation dialog.

Parameters and Variables: store, storeValue, storeText, storeAttribute, stored in JS map storedVars

Variable Substitution – JS Evaluation

Selenium Techniques

Generating UIDs

Creating Test Case JSPs.

Assert sthg not existing. assertXPath extension (on openqa).

Fits into CruiseControl.

auto="true" => /postResults => CC

Remote Control Selenium

Drivers for Java, .NET, Python, Perl, Squeak, and Ruby. Jetty-based proxy-server. Issue Selenium commands – allows to issue all commands via JUnit tests…

Purely declarative Selenium syntax can be broken up.

User-Extensions

user-extensions.js : e.g. own actions. Own locators and assertions (see openqa).

Selenium-IDE

Firefox-Extension. Recorder. With intelligent addons-e.g. forward-engineer macros to remote scripts in all languages.

###XPather + XPath Checker ###

Future

Driver capabilities. 1.0 soon. Documentation for driver. DSL-like language to supplement HTML.

File Uploads possible with Firefox.

Question: What about integration with Fit/FitNesse (e.g. http://www.cornetdesign.com/2006/09/fitnesse-selenium-wrapper.html or http://storytestiq.sourceforge.net/index.html)? Neal Ford didn’t seem to see any use for it as he understands FitNesse also for functional tests and Selenium only for acceptance tests. ###TODO: Send an e-mail  to him###

https-Support (one-time import of the certificate)

(KG’s) Summary

This is "best-of-breed" technology for free. Whoever works in smaller/midrange IT departments and wants to spend money for a commercial tool is going to burn money. The multi-language facility via the remote runner makes Selenium quite adjustable. E.g. the integration with CruiseControl and even JUnit test cases makes it highly valuable.

The Selenium IDE can compete with professional Testing UIs. It’s AJAX support is stunning. Haven’t seen any commercial competitors yet.

3 Antworten bis “JAX 2007: Testing with Selenium (Neal Ford, Thoughtworks)”


  1. Confluence: Marcel Schröder

    Über Selenium … Tests mit Selenium IDE erstellen Selenium IDE Version 1.0 Beta 2 Date: 06/03/2008 Description: Includes Selenium Core 1.0SNAPSHOT Changelog Firefox extension (requires Firefox 1.5.0.\, 2.0.0.\ or 3.0….

  2. Confluence: Marcel Schröder

    Über Selenium Quelle

  3. Confluence: Marcel Schröder

    Über Selenium Quelle: