Over the past few years I’ve built or used many a web automation framework. Lately, over the last year, I’ve settled on one particular automation framework – Golem.

I use Golem for testing all sorts of code bases. Since web automation is using Front End access, it’s really of no consequence if your code base is written in C#, Grails, Java, JS, etc.

There are several upsides to using Golem:

  • Standalone Server
  • Written in Python
  • GUI Based Test Creation
  • Can also use Python to write tests
  • Easy Browser webdriver management
  • Nice, real time reports
  • Test Suites
  • Automated Tear Down
  • Automatically captures screenshots of failed test scenarios
  • Optional Page Object Design
  • Optional Data Driven tests

Basic Setup

This document will cover getting set up with Golem.

Golem uses python, so you’ll need to have that installed first. Next you simply run pip/pip3 install golem-framework.

Once Golem is installed, you can create a project to house your tests using the command: golem-admin createdirectory [project name]

Once created you’ll get notified if the username and password.

Change into the directory we just created (cd [project name])

Inside the folder we’ll have several folders and files, as described above.

Update Drivers

Before we get to writing tests, let’s make sure we have our browser drivers updated:

By running webdriver-manager update, you’ll see different drivers get downloaded/updated.

Writing Tests via the GUI

The command golem gui when inside the project folder, we get the server started. This will output something to the console like so:

Pulling up the URL In a browser we get the main Golem screen:

Entering in our username and password, we can get access to create our test project. That screen will look like this:

At first we have no tests or projects. Click “Create Project” to get started and fill out the field with a valid project name and click ENTER.

By default you’ll be started on the “Suites” tab. A Suite in Golem is a collection of tests. At this point, we need to create some tests.

Click “Tests” on the left nav., then on the main test screen click the icon that looks like a File with a + sign. Fill in a name for your test, and hit ENTER. This will load a form for creating our first test:

There’s quite a lot one can do with a test. Some advanced features could be creating Pages of Tests that can be imported into the test. We can also create data driven tests in the cells at the bottom. This would be like running the same test repeatedly, replacing a value each time… such as testing a search box that it can take a normal search term, one with special characters, one with HTML, etc.

For the purpose of this basic and general document, I’m not going to cover these other test functions. This will just get us up and running to create a test, add it to a Suite and run the suite to get a report.

In the Test section, click in the field of the first row available. As you start tying in the field it will adjust with various Selenium actions you can call.

For this test I’m going to do a “GET” (navigate to a url) and pass in a search term.

Type “get” and then click the “get” result in the dropdown:

In the above example, I’m going to the public website: http://amazon.com – notice the quotes.

We get a 2nd line now, and this time, I’ll add a browser automation step of sending keys to the Amazon search field:

Above, this simple test has three steps now, it goes to Amazon.com, it sends the text ‘python’ to a text field with the id of twotabsearchtextbox. Finally the automation clicks the search button (which is a class called nav-input.)

Clicking the “Run Test” button at the top right of the Test creation screen will kick off the test and we can make sure it all works. For this test I added one more step, an assertion:

Running the test I get a pass… all is well.

Writing Code Directly

You can also write straight selenium calls via Python. Click the “Code” button in the upper right:

The code screen will load out like so:


description = ''

tags = []

pages = []

def setup(data):
    pass

def test(data):
    get('http://amazon.com')
    send_keys('#twotabsearchtextbox', 'python')
    click('.nav-input')
    assert_element_text('.a-color-state', '"python"')

def teardown(data):
    pass

For the most part this is pretty self explanatory, but there are some oddities to writing Python tests.. such as using library imports. Libraries can not be imported at the test level, but need to be associated to a Test Page and the page be imported. I’ll go into that in another post.

Test Suites

For this example, I’m only going to walk through one test. But in our real world examples, we’ll have multiple tests for our apps… we might be testing login, registration, search, CRUD actions, etc.

Let’s tie our test to a test suite.

This is an important step because reporting ONLY occurs on the Test Suite (not on the individual tests.)

Click on the “Suite” link in the left nav and then click on the icon of a File with a + sign in it.

In the next screen, fill out the field with a Suite name and continue on.

Next click on the newly created Test Suite name… this will take you to the Suite details:

Click in the “Browsers” Field and you’ll get a dropdown popup with all the supported browsers. You can run a suite against a variety of browsers (Chrome, Firefox, Opera, etc.)

Select a browser from the dropdown.

I hadn’t told you how to set up environments yet. For now, leave that blank. Environments are ways we can replace the base URL with a variable… such as environments like “Stage,” “QA,” “Dev-001” – and the base url for the tests would be updated accordingly.

The Processes value is how many simultaneous process you want to run. Let’s leave it at 1, since we only have one test… and finally at the bottom we see our Test Case…

All available tests will be listed here. Simply check the test cases you want to associate to the Suite and save.

Running Suites and Reports

Now that we have a Test Suite, let’s click “Run” on the Suite window and then click “Reports” on the left nav.

The tests themselves will update after completion. Green means pass, Yellow means a test failure and Blue references Tests not yet complete.

That’s it… That can get you started….

Leave a Reply

Your email address will not be published. Required fields are marked *