Talking testing, agility and automation... and anything else.



21
Aug 14

Running Geb Tests In Parallel

parallel linesBecause UI tests are inherently slow, running them in parallel–that is, running multiple tests, in multiple browsers concurrently–is all but a necessity.

Luckily, it’s hilariously easy to run Geb tests in parallel, using Maven… all you need do is add the following code to you Maven pom.xml:

And then run your tests via Maven. Eg. mvn test -Dgeb.env=chrome . You can try it for yourself by running my geb-example on GitHub.

This code will spread your tests between up to 4 threads/forks and run tests at the method (test) level. You can also swap out “methods” for “classes” if you’re prefer to run at the spec (class) level. Either way, you can dramatically speed up your automated tests with a few lines of code…

You did think about running tests in parallel when writing your tests… didn’t you?

Plusone Linkedin Facebook Twitter Digg Email

09
Jul 14

How To Do Something In An Agile Fashion

03-cat-jumping-lgnDave Thomas (PragDave) has an interesting post regarding the use of the word “Agile”. In it, he argues against the use of “agile” as a noun, preferring using “agility”… fair enough… but like the context driven folks, who would have us use the phrase “automated checks” instead of “automated tests”, I don’t really care. The argument itself may be interesting, but semantic change is a bitch; good luck!

But he also talks about “How to do something in an agile fashion”… which I found most intriguing:

What to do:
• Find out where you are
• Take a small step towards your goal
• Adjust your understanding based on what you learned
• Repeat

How to do it:
When faced with two of more alternatives that deliver roughly the same value, take the path that makes future change easier.

I love the simplicity of this. Additionally, he also states:
“…anyone who comes up with something bigger or more complex is just trying to sell you something.”

Nice work, sir… and for that, I changed my tagline to aid your cause :)

Plusone Linkedin Facebook Twitter Digg Email

19
Jun 14

Mythical Man Month or: How I Learned to Stop Worrying and Love Management

Dilbert-add-people-to-project

When I’m finally in charge, two of my first mandates will be: If you’re driving in the left lane, BE passing. But only slightly less important will be: “Please read Mythical Man Month”.

And you don’t even have to read the book if you don’t want. Simply read the Wiki page about the book and believe it. In fact, you can skip the book and the Wiki page if you’ll repeat the following three times, out loud:

“Adding manpower to a late software project makes it later”.

You may now become a manager…

Plusone Linkedin Facebook Twitter Digg Email

08
Jun 14

When To Automate

?There’s a veritable plethora of blogs, articles and papers, listing the mistakes commonly made when creating functional/ui automation… and many of these, themselves, contain common mistakes. Here’s one I recently found…

From an article “Five Common Mistakes and Their Solutions” by Artem Nahornyy:

Starting at the Wrong Time
It is a common mistake to begin test automation development too early, because the benefits almost never justify the losses of efforts for redevelopment of test automation scripts after the functionality of the application changes until the end of iteration…

Solution
During the development phase, members of a quality assurance (QA) team should spend more time creating detailed manual test cases suitable for the test automation…

Mr. Nahornyy argues that automating too early can waste efforts due to change, but the same argument can be made against his solution. Changes can also lead to waste when writing detailed manual test cases, early in development.

My advice is to start automating as soon as you can. For example, you might write automation code when devs are writing app code. Start with a failing test, and flesh out any page objects needed (or create them if they don’t exist). Then create any methods and/or data needed by the tests. This will save time later for manual/exploratory testing, when the code is complete.

Even better is if you can get access to the code in progress. Maybe by accessing your dev’s machine, or working from a branch, etc… Then you can start hooking up selectors in your page objects and perhaps even running code. More importantly, you can sniff out early bugs in the html/css/javascript, or even in the ui. This is also the perfect time to ask for css changes to solidify page object selectors. Eg. add a css id to an element to save you from using a more brittle solution. It’s WAY easier to get a dev to add an id while they’re still in the code, rather than later down the line.

Truth is, I would generally argue that it’s a mistake to automate too late, rather than too early. The ability to run even the simplest automated tests during a release can add real value. Kicking the can down the road with automation might at best, bloat your backlog, and at worst, never come to be.

Plusone Linkedin Facebook Twitter Digg Email

26
Apr 14

Running Test Suites In Geb

sweetsMaybe you’re looking to run a number of tests against a new build, or perhaps you just can’t wait for the overnight Jenkins tests to run. Whatever the reason, running multiple Geb tests/specs from your IDE is a snap, thanks to JUnit’s sweet suite functionality.

To the code!

We use two annotations: @RunWith, to specify the runner to run the suite, and @Suite.SuiteClasses, that specifies an array of tests/specs we’d like to run. Just add any specs you’d like run in the array, with .class appended and separated with a comma.

Lastly, we have our actual class, which is left empty. All you need do is run the suite and all your specified tests will run.

I’ve added this code to my Geb examples project on GitHub, so you can play along at home!

Plusone Linkedin Facebook Twitter Digg Email