Monday, July 23, 2012

Cross Browser Fun: Adventures in TestCompleteLand

As I said previously, I'm looking to see how TestComplete would work were I to try to use it to handle some of my regular or desired testing. That means handling my environment as is, which is that Sidereel is a Rails app. Some of the bigger challenges I currently face are that it's a bit of a headache to do a lot of cross browser testing with my current setup of Gherkin and Cucumber with Ruby (not impossible, it just requires some tweaking and making sure everything plays nice).


The benefit (ideally) of having a tool like TestComplete is that it is meant to be a self contained solution. While Selenium/Webdriver/Capybara/Cucumber/fillInTheBlank requires a fair bit of integration to get everything to play together, I was curious to see what I could do out of the box to focus on cross browser testing (and not just some random demo site, but my site that I have to actually test!).

Here's a basic example:

- Using TestComplete, record a test where I open a browser window.

- Go to www.sidereel.com

- Click Log In to get to the fields for the username and the password.

- Enter the username and password.

- Click Log In.

- Make a checkpoint to that we can tell that the page has the right username.

- Click Log Out.


The test runs, albeit the record process creates a bit of detritus that I then ended up having to strip out (wait states, hover points, mouse movements, etc.). Still at the end of the process, we have a working script.


So what does it take to make a cross browser test? This is pretty slick, to tell the truth. What you do is you create a 2nd test file, and that acts as a wrapper and a controller. You put the calls for the browsers you want to run, and then you call the test you want to have run/repeated. In this case, the login test can be set up to run on IE, Firefox and Chrome, and if we want to set up conditionals or loops, we can do that to run the tests as many times as we want to.

Showing a hiccup when we try to test all three browsers; the setup of each browser is shown at the bottom. 

Yeah, this is a simple and quick example, and it doesn't necessarily tread on a lot of new ground. I would be interested to see how well this setup tests and identified CSS variations, since that's something that I deal with regularly (especially between browser versions; would TC catch any differences, or would I have to eyeball that to make the identification and make the call of it being a bug or not? Something to think about :).

No comments: