AlexKaras's avatar
Champion Level 3
8 years ago
New Idea

Script Extensions need to be enchanced with the init / finalize functionality

Request is based on the thread, Support Case #00243012 and

my resent attempt to move some service code into script extension of runtime object type.


As an example, I have a code that gets the content of the configuration file and returns a value of the requested configuration parameter. In order to avoid constant getting of the file content, the content is obtained once on the first request and is kept then in some local variable.
This works well in the regular code because the variable is initialized on every test run start.
Unfortunately, I am sorry to say that the code that uses some dynamic resource (configuration file, database access, URL address, etc.) is near to impossible to use from script extension. The problem is that code in script extension has no indication of whether the value of the resource stored in the property of script extension corresponds to the current test run or was left from the previous one and need to be re-initialized.
Of course, script extension can have some initialization code and this code can be executed from, say, OnStartTest event. But this: a) complicates design of test project; and b) in most cases, initialization is needed not on start of every Test Item (which is the case if OnStartTest event is used), but on start of test run (like it occurs for Temporary Project Variables that are initialized on test run start and persist until test run end).


I would really ask, in addition to the already existing InitRoutine and FinalRoutine (specified in the description.xml file for the given script extension), to enhance Script Extensions with TestRunInitRoutine, TestRunFinalRoutine, TestItemInitRoutine and TestItemFinalRoutine routines triggered on test run start/end and test item start/end respectively.


Script Extensions is a great feature of TestComplete, but, unfortunately, without mentioned routines it is hardly usable for runtime objects that use dynamic resources.



No CommentsBe the first to comment