Forum Discussion

dpirs's avatar
dpirs
Occasional Contributor
14 years ago

How to perform setup and cleanup in keyword tests

Some time ago I have used NI TestStand for developing the tests. It had a nice setup/cleanup feature, this was part of the keyword test that was executed every time on the beginning of the test and on the end of the test.

Main advantage of cleanup sequence was that it was also executed when some error occours or the test is stopped. In that way the test bed (or tested application) was brought to the defined state every time no matter what happened during the test.



How to do this kind of thing in TestComplete Keyword Tests? 



Thanks,



Daniel

1 Reply



  • Hi Daniel


    To perform setup/cleanup actions in keyword tests, you can use the Try, Catch and Finally operations, which are analogues of the try...catch...finally statements in C++, C# and other programming languages.


    They are the operation groups:



    • The Try operation holds operations that may cause an error. 

    • The Catch operation contains operations that will be executed if an error occurs in the Try block. 

    • The Finally block contains operations that will be executed regardless of whether an error occurs in the Try block. 






    Regards.