The written tests should be regularly launched, wherein it is preferable to have a handy tool for organizing and launching the tests. In TestComplete, there is Test Items project element that is meant for organizing and launching the available tests.
In this recipe, we will learn how to add Test Items to the project and customize tests parameters.
Create several functions which will be treated as tests to be added to Test Items. They can contain any actions or even lead to no action at all.
In order to create test plan, we need to perform the following steps:
Test Item is a special element of the project, which is designed for easy management of tests launches. To the left-hand side of each Test Item there is the Enabled checkbox, which allows at a single mouse-click to exclude the tests from being launched.
Besides, for each of the Test Items there are two more interesting customizations: Count and Timeout (they are assigned in the corresponding columns). The first one of them allows launching the test several times consecutively when needed, while the second method allows setting time in terms of minutes, upon expiry of which the test will be considered as a hung-up and stopped with a corresponding error entered in the log. Meanwhile, all the other tests will be launched as usual.
Moreover, if the tests accept some parameters, they can be assigned in the Parameters column. All the Test Items are independent of each other and in particular, on the functions they are bound to, this is why it is possible to create several Test Items that would launch one and the same function (for example, with different parameters or at a different time).
Working with the Test Items is possible directly from the tests, as the Project.TestItems
object is being used to this end. For example, in the following code, we place the name of the current Test Item into the log:
Log.Message(Project.TestItems.Current.Name);
18.191.139.169