When coding tests, we are using different programming constructs (for example, if…else
, try…catch
, and so on). Some of them are used rarely, while others, conversely, are used very often.
TestComplete allows us to accelerate input of some of the programming constructs with the help of so called code templates.
Several of the templates are already predefined in TestComplete; however, they do not always suffice for the job. That is why we will learn how to apply the preset templates and to create some of our own.
Suppose we would like to create a template of our own for the if…else
block of JScript code:
ifelse
to witness exactly the same code appear in the editor as previously inputted in the listing of the templates.We have added a new code template for the if...else
construction for JScript language, and it can now be used in any TestComplete project.
Please note that code templates are different for all languages, so if you want to add the same construction for C++Script language, you need to repeat the preceding steps again.
In the following screenshot you can see how our template will look after performing all these steps:
3.21.104.183