Tests and Sub-Tests

Top  Previous  Next

The concept of Sub-Test is an organic way to organize the whole work with Tests in organic way. By having sub-tests one may meet one of the following goals:

 

1. Create multiple test scenarios working with same set of Objects and Functions.

2. Organize different test scenarios into a single workspace.

3. Use Sub-test to make cross-browser tests

 

We will consider each of described goals separately. The test containing the sub-test(s) we will call base or parent test.

 

Make Multiple Test Scenarios with the Same Set of Objects

 

In this case 'parent' test contains all learned objects and user-defined functions.

 

SubTestDependant

 

 

For example, the parent test may have objects "User Name", "Password", "Sign On". And function

function Login(username, password)
{
   ...
}

 

SubTest1 may be used to check login with valid Credentials, SubTest1.js looks like:

function Test()
{
   Login("validuser", "validpassword");
   // Now check that login is successfull

   Tester.Assert("Login leads to welcome message: ", Global.DoWaitFor('Welcome_User'));
}

 

SubTest2 may be used to check login with invalid Credentials (i.e. it is a fail-test). SubTest2.js looks like:

function Test()
{
   Login("invaliduser", "invvalidpassword");
   // Now check that login is successfull

   Tester.Assert("Login leads to invalid user object: ", Global.DoWaitFor('Invalid_User'));
}

 

Function Login and objects Welcome_User and Invalid_User are defined in Test. The subtests are just implementing various scenarios for the same set of objects.

 

Organize different tests into a single workspace.

 

Each test has its own objects, functions and scenarios.

 

SubTestWorkspace

 

 

The usage of such an approach is well demonstrated by example. We created a test called 'SampleMaster' and put all SmarteStudio samples into it by using Add File context menu in the the Test Tree dialog. Finally the Files tree looks like:

 

SubTest SampleMaster Tree

 

All tests in this tree are independent. We use the Sample Master to manage all the tests from a single environment.

 

Using Sub-Tests for a Cross-browser testing

 

See 'Cross Browser'.

 

 

Sub-Test Features

 

Sub-test may have its own nested sub-tests. For example, in the parent test contains reference to 'CrossBrowser' subtest having 'IE' and 'Firefox' subtests inside:

SubTest Nesting

 

Sub-test options are available from the 'Tag' property in the 'Properties window:

SubTest TagProperties

 

The following options are available in the context menu fore each of the sub-tests:

 

SubTest Tree View File Options

 

Play: Execute selected sub-test
Record: Start recording into selected sub-test
Save: Save options of a sub-test
Show Objects: Show objects form a sub-test in the Object Tree
Delete: Remove reference to a sub-test from its parent test