Creating tests
The Test organizer module allows for creating test cases for the database objects to make sure they operate in a similar way. Users can both create tests manually and also auto-generate them to automate the process.
Users can create tests for the following metadata objects:
- Table
- View
- Procedure
- Functions
Creating tests
- Select an object in the Source and Target metadata tree.
- Click the + button or choose the Create test option in the context menu (Figure 1). The New test creation wizard opens (Figure 2).
Note: These options are disabled if users didn’t select any object in the Source and Target metadata tree, or if users selected on an object of the wrong type, that is not supported to create tests.
Figure 1. New test creation
- In the New test tab of the New test creation wizard (Figure 2) enter the test name and description and select a test template:
- Empty template — suits to create tests for any supported object. The parameters and SQL script fields will not be filled automatically.
- Call template — suits to create tests for Function and Procedure objects. The Parameter field content depends on the object type. The main SQL filed contains the calling routines script. Pre and Post scripts are empty.
- Select template — suits to create tests only for Table and View objects.
- Insert/Update/Delete templates — can be used only to create tests for the Table object.
Note: The number of available templates depends on the selected object type. For example, the Call routine template will be available for programmability objects, such as procedures or functions.
Figure 2. Template selection
- Press Next to continue. The Definitions tab opens.
Figure 3. Definitions
- In the Definitions tab set the test parameters and specify the Pre Script, SQL, and Post Script.
- The Pre-script is executed before the main SQL. If the pre-script execution fails, the main SQL and the Post Script won’t be executed and test execution will be completed with error.
- Post Script is executed after the main SQL.
- Press Next to continue. The Affected data objects tab opens (Figure 4).
Note: Adding the affected data objects is an optional step required in case if some data objects changed during the test execution. The Refresh button allows the system to retrieve and resolve the affected objects automatically. You can also add the pairs of affected objects manually. However, we do not recommend that unless you are absolutely sure it is necessary. When set incorrectly at this step, the affected objects may cause errors during the test execution.
Figure 4. Affected data objects
Users can compare the objects affected by the test execution using the following strategies:
- Row count
- Fast Comparison
- Detailed Comparison
- Press Next to continue. The Setup and Teardown tab opens — this step helps users choose the backup method.
The Save pretest database state option allows for automatic creation of databases’ state and configuration that will be restored after the test is over. To do that, users need to specify the source and target backup locations.
The Restore initial dataset option acts similar to the Golden copy functionality and requires a dataset that can be created in the Data Store module. To use this option, users need to specify the source and target dataset names.
Figure 5. Setup & Teardown
- Сlick the Save button for creating a new test.
After saving a new test it appears in the selected group of the Test Suite tree.
Figure 6. New test added
Didn’t find the answer?
You can report problems, ask questions or share ideas for improvements on our email [email protected].