Using Test Suites

We have so far created a test to open and to search for given terms. We could keep adding steps to this one test but doing so will eventually be impractical.

One test per user journey is more manageable and easier to maintain. This will lead to a collection of tests covering a range of pages, functionality and user journeys. Tests will vary in their level of critical importance.

A test suite brings together a collection of tests grouped in a manner that fits your needs. A given test can be present in any number of test suites.

You might want to group tests by priority, examining first the most critical user journeys as grouped in one suite and then examining afterwards some lower-priority functionality grouped in further test suites.

Let’s see how this works by creating some more tests for Google.

Additional Google Tests

Google has a store where you can buy devices and accessories. The page at presents an overview of the company. Let’s create some tests for those.

# examples/test/google-store.yml
    - chrome

"verify Google Store is open":
    - $page.url is ""
    - $page.title matches "/^Google Store/"

"top navigation elements are present":
    - $"div[new-product-nav]" exists
    - $"div[new-product-nav] button[data-category-id='phones']" exists
    - $"div[new-product-nav] button[data-category-id='connected_home']" exists
    - $"div[new-product-nav] button[data-category-id='tablets']" exists
    - $"div[new-product-nav] button[data-category-id='laptops']" exists
    - $"div[new-product-nav] button[data-category-id='accessories']" exists
    - $"div[new-product-nav] a[href='/collection/offers']" exists
# examples/test/about-google.yml
    - chrome

"verify is open":
    - $page.url is $config.url
    - $page.title is "About | Google"

"top navigation elements are present":
    - $"nav .top-nav" exists
    - $"nav .top-nav a[href='./']" exists
    - $"nav .top-nav a[href='./google-in-uk/']" exists
    - $"nav .top-nav a[href='./products/']" exists
    - $"nav .top-nav a[href='./commitments/']" exists
    - $"nav .top-nav a[href='./stories/']" exists

Creating Test Suites

A test suite is a YAML list. It doesn’t get much easier than this.

Create a YAML document for your test suite and within define a list of imports. The first test imported is the first to be run and so on.

# examples/test-suite/google-high-priority.yml

- "../test/google-search-query-literal.yml"
- "../test/google-store.yml"
# examples/test-suite/google-low-priority.yml

- "../test/about-google.yml"