This is the third element inside <TestSet>
. Inside this element, you specify the execution flow for the test cases. In the simplist case, you would include the child element <RunTestCase>
with its inner text the id
of a <TestCase>
. For information about <TestCases>
, please refer to TestCases.
<TestCaseFlow>
<RunTestCase>Navigate to Google</RunTestCase>
</TestCaseFlow>
<TestCases>
<TestCase name='Hello World - Navigate to Google!' id='Navigate to Google'>
<RunTestStep>Opening Browser</RunTestStep>
</TestCase>
</TestCases>
If we are given this XML provided above, our execution of test cases include only one test case "Navigate to Google". Here, the framework will run the test case with the id
of "Navigate to Google".
<TestCaseFlow>
<RunTestCase>Navigate to Google</RunTestCase>
</TestCaseFlow>
<TestCases>
<TestCase name='Hello World - Navigate to Google!' id='Navigate to Google'>
<RunTestStep>Opening Browser</RunTestStep>
</TestCase>
<TestCase name='Hello World - Open Browser!' id='Navigate to Google'>
<RunTestStep>Close Browser</RunTestStep>
</TestCase>
</TestCases>
If we are given this XML provided above, our execution of test cases include only one test case "Navigate to Google". Here, the framework will run the first test case with the id
of "Navigate to Google". Therefore, we would be looking at this element for the test case:
<TestCase name='Hello World - Navigate to Google!' id='Navigate to Google'>
<RunTestStep>Opening Browser</RunTestStep>
</TestCase>
We also note, that the name
of the TestCase
element can be different than its id
.
For any automation, we usually include some type of conditional logic. Inside a test case execution flow, you can introduce the <IF>
child element to check for an web element's condition. A web element condition can be either "Exist"
or "DNE
".
<TestCaseFlow>
<If elementXPath='//div' condition='EXIST'>
<Then>
<RunTestCase>Fake Test Case ID 2</RunTestCase>
<RunTestCase>Fake Test Case ID 3</RunTestCase>
</Then>
</If>
</TestCaseFlow>
If we are given the XML above, the framework would interpret it as checking whether an web element with xpath
of "//div" "EXIST"
. If it does, then it will run the block inside the child element <Then>
. Here, it will run both "Fake Test Case ID 2" and "Fake Test Case ID 3".
Note that this definition is recursive, so the following is also a valid.
<TestCaseFlow>
<If elementXPath='//div' condition='EXIST'>
<Then>
<If elementXPath='//a' condition='EXIST'>
<Then>
<RunTestCase>Fake Test Case ID 2</RunTestCase>
</Then>
</If>
<RunTestCase>Fake Test Case ID 3</RunTestCase>
</Then>
</If>
</TestCaseFlow>
Like any programming language, we can specify else if and else logic.
<TestCaseFlow>
<If elementXPath='//div' condition='EXIST'>
<Then>
<RunTestCase>Fake Test Case ID 1</RunTestCase>
</Then>
<ElseIf elementXPath='//a' condition='DNE'>
<RunTestCase>Fake Test Case ID 2</RunTestCase>
</ElseIf>
<Else>
<RunTestCase>Fake Test Case ID 3</RunTestCase>
<If elementXPath='//img' condition='EXIST'>
<Then>
<RunTestCase>Fake Test Case ID 4</RunTestCase>
</Then>
<Else>
<RunTestCase>Fake Test Case ID 5</RunTestCase>
</Else>
</If>
</Else>
</If>
<RunTestCase>Fake Test Case ID 6</RunTestCase>
</TestCaseFlow>
The framework would interpret this test case execution flow as: