A common scenario for Front End testing is to setup the automation suite to run against a specified set of browsers. That approach is very common, and has its merits, but how do you tackle that same scenario when the System Under Test (SUT) does not have an output display, such as a Continuous Integration (CI) environment? CI servers often only utilize a Command Line Interface (CLI) to access the server, and do not provide display output.
One solution is to run the tests headlessly, using a virtual browser such as Xvfb (X virtual framebuffer). Xvfb enables automated tests to run in the CLI without a graphical front end. It displays PASS/FAIL results in the CLI realtime!
How do we know if the tests render the page the way we desire if we can’t see what is being drawn on the display? Robot Framework provides report and log files after execution, and during test execution you can tell it to take a screenshot for the Page in Test (PIT). Those screenshots are added to the report file for ease of consumption!
Sample test code can be found on my GitHub repository: