SilkTest Question 19: How to execute the string as the function?

During SilkTest training session I was unsuccessfully tried to create script which can read string from a text file and execute string as the function. Is it possible?

The following 4test code use the @ operator for function reference. Make sure that that the calling function is defined or you will get an exception. For more details on the @ operator take a look into the appendix of the language reference provided by Borland.

[-] testcase foobar() appstate none
// prints directory on the host machine where startup include files located
[ ] string sFunc = "GetStartupDir"
[ ] string sDirectory = @(sFunc)()
[ ] print(sDirectory)

No comments:

SilkTest interview questions for QA Testers