Speeding up UI Browser tests with Robot Framework

Speeding up UI Browser tests with Robot Framework


My current AWS demo project is a Cat Voting Booth.  It uses SocketIO/WebSockets, so in addition to server-side unit tests Ive built a number of browser-level tests, using Robot Framework.

One feature people dont realize is that Robot can actually be quite speedy. Opening and closing a browser window is very slow, on the order of 1-2 seconds. Depending on the application, this can be done once, saving 1-2 seconds for *every* test!  For my Very Important Cat Voting Booth, this is the case.

Heres the magic bit:

*** Settings ***
Resource          resource.robot
Test Setup        Reset Votes
Suite Setup       Open Browser To Voting Page
Suite Teardown    Close All Browsers

*** Test Cases ***
Valid Page
    Votes Not Available

Register Up Vote
    Vote Up
    Element Text Should Be    vote-count-up    1
    Element Text Should Be    vote-count-down    0

Normally, Robot will open/close a browser on each test.  The above stanza says "Test Setup: Reset Votes", that is, itll reset my database and *not* open a browser.  The suite-level setup is "Suite Setup: Open Browser", which means Robot will open a browser once and not per test.  Similarly the suite-level teardown closes all the (Robot-created) browsers.

I can run four (admittedly modest) browser-level tests, in a full real browser, in four seconds! This includes going back and forth to my Flask-SocketIO server, interacting with Redis, and other things.  Im quite happy with this result.

As a heavy Test Driven Development (TDD) guy, with the above speed I can do full browser-level tests as TDD!  I dont have to wait until I absolutely *have* to run UI tests, they can be fast enough for running many times an hour, to give me very fast development feedback.

Full source code here: https://github.com/johntellsall/aws-realtime-metrics

download file now

Comments

Popular posts from this blog

Spider Man Friend Or Foe ISO Free Download PPSSPP Setting

Sorry Mutter closed unexpectedly on Ubuntu 10 10

Solution Ubuntu 10 04 minimize maximize and close button to right