Data Models in Test Automation
What’s it about?
Automated tests represent a certain test logic as a sequence of steps, manipulating data and interacting with a GUI.
Test data, as in manual testing, could be data we feed into application-under-test (input data), retrieve from application-under-test (actual data, or actual result), and compare with (expected result).
These data have to be stored in some form.
Even if test data presented “as is”, i.e. hard-coded, this is a primitive data model.
Data Models by the level of organization
Chaotic data model
Unorganized, scattered across the code data. Typically it’s a mix of hard-codings, constants and variables.
- No formal naming convention
- No or unorganized initialization and clean-up routines
- No isolation and protection mechanisms
- Extremely hard to maintain
Linear data model
A set of variables and constants is used to store test data. All names are declared beforehand, typically, at the top of the script.
- Might follow naming convention (but often doesn’t)
- Might have informal initialization and clean-up routines
- No isolation and protection mechanisms
- Hard to maintain
Array-based data model
An array, set of arrays, or a table-type object is used to store test data. Data value names are indexed.
- Typically has naming convention
- Has initialization and clean-up routines
- Might have isolation and protection mechanisms
- Average maintenance effort
Table-based data model (Data Table)
A set of tables as a single object. Example: DataTable object in QTP.
- Enforced naming convention (column names)
- Standardized initialization and clean-up routines
- Supports data isolation and protection
- Low maintenance cost
Tree-based data model (Data Space)
Data structure (object class) with an access based on associative programming methods. Supports tables, but also supports loops and branching within a single data row.
- Enforced naming convention (indexes)
- Standardized, built-in, automatic initialization and clean-up routines
- Supports data isolation and protection
- Supports run-time data branching, transformation, import, and export
- Lowest maintenance cost