Nice article. I’m also a big fan of Acceptance Test-driven development. If anyone is interested in ATDD for web apps, they should check out Helium (http://heliumhq.com). (I’m one of the cofounders). It lets you write executable test scripts of the form
startChrome();
goTo(“Google.com”);
write(“Helium”);
press(ENTER);
click(“Helium – Wikipedia”);
assert Text(“Helium is the second lightest element”).exists();
This is Java, Python bindings are also available. Note how no reference to any HTML source code properties is required (thus the tests can be written in a TDD style, before the implementation).
I should also point out that Helium is a commercial product, so you (/ your company) has to pay to use it.
Does your product provide proper page objects? The way it's used in the examples (where the test specifies the direct page interactions) will quickly create difficult to maintain code. For example, http://canvascode.wordpress.com/2013/11/20/maintainable-auto...
I just recommend instead using a custom data- attribute to identify your elements so you don't rely either on text, HTML structure, or CSS classes since all of those can change but may not affect functionality therefore should not break your test.
I ended up writing a Selenium-IDE plugin for a similar thing with hierarchical "data-test-label" attributes, since our test-team seemed unwilling to actually learn XPath, and the default Selenium-IDE output was far too hyper-specific and brittle.
That's surely a good solution. It requires write access to the source code of the web application being automated though.
That's not to say that Helium is a silver bullet. It certainly always depends on the context. For instance, I know of a bank here in Austria that generates a lot of the Java source code for their internet banking app from an abstract model. They also generate page object code immediately from this abstract model, which is therefore always up to date and precise. This is one example where I would say using Helium would probably not pay off.
startChrome();
goTo(“Google.com”);
write(“Helium”);
press(ENTER);
click(“Helium – Wikipedia”);
assert Text(“Helium is the second lightest element”).exists();
This is Java, Python bindings are also available. Note how no reference to any HTML source code properties is required (thus the tests can be written in a TDD style, before the implementation).
I should also point out that Helium is a commercial product, so you (/ your company) has to pay to use it.