I initially assumed that I would have this post up within a week of the previous, but life got in the way as it so often does.
Now that I got everything set up, it’s time to move on. In this second part, I am going to concentrate on getting Selenium 2 WebDriver going with Groovy. Selenium 2 out of the box supports .NET and Java, so why Groovy? There are several reasons: 1. SoapUI (to be discussed later) supports Groovy natively, 2. I like scripted languages for test automation better than compiled languages, and 3. why not?
I had been working with Selenium RC and .NET for some time, and had put together the basis of an automation framework. So my first step was to rewrite everything in Java, and just call it Groovy. All this was actually surprisingly easy to accomplish, especially with my very limited knowledge of both Java and Groovy. I want to stress that what I have here (the previous two links) is just the beginnings of a test framework. It meets my initial requirements: that it run in Groovy, and that it use 100% WebDriver. I am certain that it can (and will) be further optimized, but I would hope that anyone starting with this will get a good idea of where this is heading.
still to do:
- Get everything running from the command line.
- Use it in a real-world project.
- Make everything more Groovy.
couple of surprises along the way:
- Man, love the lack of Selenium server. No more Java memory crashes.
Yay! - In JUnit4 the signature of asserts changed from (NUnit’s) Assert.AreEqual(expected, actual, message) to Assert.assertEquals(message, expected, actual). The message goes at the beginning?
- In webDriver, getting the value of a textbox changed from selenium.GetValue("name=q") to txtSearch.getAttribute("value"). Nice!








