Opera Core Concerns

Official blog for Core developers at Opera

Subscribe to RSS feed

Posts tagged with "watir"

First Selenium Meetup in Oslo

, , , ...

This Friday 19 August Oslo will see its first ever Selenium and Watir meetup. The meetup will be hosted by Opera at our headquarters and is open to anyone with interest in automated web application testing or browser automation!

About Selenium

Selenium automates browsers. What you do with that power is entirely up to you. Primarily it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.

Selenium has the support of some of the largest browser vendors who have taken steps to make Selenium a native part of their browser. It is also the core technology in countless other browser automation tools, APIs and frameworks.

Talks

Jari Bakken will give an introduction to what WebDriver and Watir is all about, and give you good arguments for why using these tools for testing the whole stack is the way to go.

Kristian Rosenvold will give his talk “Test First Development of Web Applications”, a fun live-coding demo he gave at Smidig 2010.

Speakers

Jari Bakken: As a core developer on both the Watir and Selenium projects, and the founder of related projects such as Celerity and watir-webdriver, Jari has extensive experience in the web test automation space. Since late 2009 his open source efforts have been focused on Selenium 2/WebDriver, for which he wrote and maintains the official Ruby bindings. His watir-webdriver project, an implementation of Watir's API on top of the WebDriver technology, marks an important step forward in consolidating the Watir and Selenium projects on the best browser automation tech available.

By day Jari works as a test engineer for Norwegian classified ads site FINN.no, where he develops automation solutions and test infrastructure. By night, he enjoys hacking on Ruby tools and making use of his degree in jazz guitar.

Kristian Rosenvold: Agile pragmatic programmer in Java, javascript, C# & Web-technologies, git-nerd. Apache Maven committer, Selenium committer. Works as a consultant for Zenior AS.

Practicalities

Where? Opera HQ, Waldemar Thranesgate 98 (entrance close to Sanner bridge at Alexander Kiellandsplass)
When? Friday 19 August at 15:00 CET
Who? Anyone! The event is free and open to the public.

If you are attending, please sign up so that we know approximately how many people are coming.

OperaWatir pre-release

, , ,

The Norwegian Opera & Ballet House in Bjørvika, Oslo. Notice the water.

Photo: Rafał Konieczny, CC by-sa

We are pleased to announce the pre-release of OperaWatir, a library for driving the Opera browser. It is the latest addition to the Watir family, a toolkit for automating interactions with web browsers, and to Opera Software's range of testing frameworks.

OperaWatir provides a querying engine and Ruby bindings to OperaDriver, the back end library. It lets you easily and automatically test your web applications just like a human would, simulating mouse clicks, text entry and the submitting of forms, reporting the results back so you know when things work, and when they break. By using a real web browser to test exactly what users see you are ensuring that your entire stack, including HTML, scripts, styling, embedded resources and back end functionality, is working.

At Opera Software, we use Watir not only to test web applications, but also for testing the browser itself. We have about 1,200 automated renderer tests running against every new internal build we compile. You can read more about the background of OperaWatir and testing at Opera in an earlier blog post my colleague wrote in 2009.

The source code is already available on GitHub, so you can go and check it out now! While the OperaDriver back end is not yet free software, we aim to release it early next year.

We need to point out that this is a pre-release, and that it should not be considered stable or suitable for use in production yet. Also, while we maintain compatibility with the current Watir implementations, it includes a proof of concept API based on Jari Bakken's ideas for Watir 2. For the more technically inclined I would highly recommend having a look at our ideas. If you have any feedback, let us know! It is our hope that we can discuss and develop this API further in cooperation with the other Watir implementors.

We hope you will enjoy playing around with OperaWatir. You are likely to find some bugs, but we decided to follow the release early and often principle, and push it out to the public before Christmas rather than waiting for another month or two until it is pristine and perfect.

We hope that you will enjoy this little Christmas gift, and furthermore, we wish you a Merry Christmas and a Happy New Year from us here at Opera Software in Oslo!

Test automation with OperaWatir

, ,

To make sure new versions of our browser core are of sufficient quality before making their way into any of our products, we run more than 100,000 automated tests on a number of different reference configurations every time we have a new build.

We run automated visual tests, JavaScript tests, selftests, performance tests, stability tests, memory tests and a lot more. One thing we have been missing, however, is automated tests for the things that require some sort of user interaction--clicking links, filling out forms, interacting with complex Web applications.

That is ... until now.

We are working on adding support for driving the browser through our scope protocol, which is the same protocol we use for the Opera Dragonfly debugger. Through a simple script, we can instruct the browser to automatically to search Google, log into Hotmail and send a message, buy books at Amazon or find plane tickets at Expedia.

Here's an example of what such a script can look like:

require "operawatir"

browser = OperaWatir::Opera.new
browser.goto("http://www.google.com")
browser.text_field(:name, "q").value = "Wikipedia"
browser.button(:name, "btnG").click

browser.link(:text, "Wikipedia").click

puts "PASS" if browser.text.include? "Wikipedia"

The syntax above is that of the Watir API, a Ruby test tool originally developed for Internet Explorer that is now being ported to Opera and other browsers.

Below is a video of the script running in the desktop version of our browser. We've had to slow it down significantly for you to be able to see what's going on - the test normally takes a few hundred milliseconds.

Through scripts like these, we can automatically test many of the things our millions of users do every day. If we break anything and a test fails, our scripts will instantly notify us so that we can fix it.

But testing these things on our x86 test builds is not enough. We ship on hundreds of different devices every year and need to run the same tests on many different platforms to make sure everything is still working after porting.

When using the scope protocol, it doesn't really matter if you're talking to an Opera instance locally or remotely; it was built for working on any device. Here's the exact same script running on a mobile phone:

Shortly after we started working on this tool, we figured that this might not just be useful for us testing our browser engine, but for Web developers testing their own Web applications, too. Our new tools are still in a pre-alpha stage, but as they mature over the coming months, we would like to make them available to all of you as well.

There are several different browser drivers out there, and we would like to support the most popular ones. The script above was using the Watir API. The following script is doing the same thing through Webdriver, which will be used in the next version of Selenium:

public class OperaDriverExample  {
    public static void main(String[] args) {
        WebDriver driver = new OperaDriver();
        driver.get("http://www.google.com");
        WebElement element = driver.findElement(By.name("q"));
        element.sendKeys("Wikipedia");
        element.submit();
        WebElement wikipediaLink = driver.findElement(By.linkText("Wikipedia"));
        wikipediaLink.click();
        System.out.println("Page title is: " + driver.getTitle());
    }
}