Control the execution of tests in a referenced test suite from the parent test suite

Ramiro MartinezRamiro Martinez Posts: 47 admin

Example Use Case
Question:
You have a test suite that contains many authentication procedures that you need to use in order to do your functional testing, but your scenarios only require you to execute certain authentications when performing certain tests. How do I control the execution of the tests in the referenced test suite from the parent test suite?

Answer:
Since referenced test suites cannot be modified in the parent test suite the only way to control the execution of tests in the referenced test suite from the parent is through the use of variables and Test Flow Logic.

Tutorial
Scenario:

Authentication.tst contains three authentication calls (A, B, and C) that must be referenced for use in other tests.
Tests.tst contains three different test cases (X, Y, and Z) that must authenticate before being executed.
X needs A and C
Y needs B and C
Z needs C

Solution:
Authentication.tst
Add three variables (a, b, and c) to the "Authentication" test suite's Variable tab, set the Type to "Boolean" and "Use value from parent test suite (if defined)", and set the Value to "false"

Under Execution Options > Test Flow Logic set each test to test (A, B, and C) to have Variable Condition with their respective variables (a, b, and c) and select "true", then save the test suite.

Tests.tst
Since X needs A and C add two boolean variables to test suite "Test X" (a and c) and set their values to "true", then save the test suite.

Since Y needs B and C add two boolean variables to test suite "Test Y" (b and c) and set their values to "true", then save the test suite.

Since Z needs C add a boolean variable to test suite "Test Z" (c) and set it's value to "true", then save the test suite.

Tagged:
Sign In or Register to comment.