Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

CRUD Tests

mplorentz edited this page May 1, 2015 · 2 revisions

This wiki describes the design of the test_orders and test_customers tests. These are functional tests designed to make sure that basic creating, reading, updating, and deleting of Orders and Customers works correctly.

You can run these tests with the test_customers_config.json and test_orders_config.json files.

Page Models

The design pattern used for these tests is the Page Model pattern. This involves modeling the common actions on each page of a website. This keeps the test code free of the implementation details of a particular page, and keeps the code to interact with a given page DRY. You can find the Page Models for these tests in the /tests/page_models directory.

Resource Group Usage

Both the Customer and the Order tests are designed to take one object through each of the CRUD actions. Since these tests are also designed to be thread safe they have to take precautions to make sure that no other tests are interfering with the state of the pages they are trying to verify.

In the TestCustomers class part of the process for verifying that a customer has been successfully created is by counting the number of customers before and after the creation. This means that while one thread is creating a customer no other threads can change the number of customers that exist (by creating or deleting one). This dependency is represented by the CustomerListResource, which you can see decorating the testCreateCustomer and testDeleteCustomer methods.