My current AWS demo project is a Cat Voting Booth. It uses SocketIO/WebSockets, so in addition to server-side unit tests I’ve built a number of browser-level tests, using Robot Framework.
One feature people don’t 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.
Here’s 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, it’ll 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. I’m 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 don’t 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