CubicTest - Test Modeling Tips

Use Extension Points for your front page, logged in state and start of all main functions

Tests typically need common setup such that they start from a well known condition (e.g. logged in and on front page). Initial tests that for example logs in the user and creates an extension point for the logged in state should be created such that each normal test of an application function can start from such an extension point. Starting from such a "logged in extension point", another test laying out extension points for all main functions of the application should be made, such that tests related to "Function A" can start from a "Function A extension point".

Use subtests as building blocks

For tests involving many pages/states and transitions one should consider using subtests as building blocks to make the test more readable and maintainable. Such sub test building blocks can then be used in variations of the same test and in other tests. Sub tests can have either an Extension start point (uses common setup) or a sub test start point using no test setup.

Use Contexts extensively

Contexts are a good and robust way to identify elements. Use them. Good examples of contexts are tables, rows and sections of the page (HTML "div" elements).

Improve and refactor the recorded tests

The CubicTest Recorder is a useful tool for recording tests for an existing web application. Recorded tests should be improved with e.g. contexts grouping together elements, use of Commons, decomposition into subtests (use copy and paste), and better Label / "Show in editor" identifier values for better readability. CubicTest has refactoring support for moving subtests to other directories (paths are updated automatically), and support for extracting a subtest of selected pages/states (select the nodes, and right click -> Refactor -> Extract subtest).

Avoid extensive use of tree-tests

Tree tests (tests with more than one path) can complicate tests if used for long paths. Tree tests is best used for small variations in a test, and not for writing multiple tests in the same test file.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.