Calling a keyword test using the string representation of the actual test
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2010
04:52 AM
06-22-2010
04:52 AM
Calling a keyword test using the string representation of the actual test
My goal is to create a vbscript function that has one string parameter. The string parameter will be the name of a keyword test to run within the vbscript function. Is there a way to use the KeywordTests object to lookup the corresponding keyword test based on this string? If not, is there another way to achieve running a keyword test based on the string representation of the test itself?
Thanks
Thanks
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2010
07:06 PM
06-22-2010
07:06 PM
Hi Lawrence,
Have a look at the native VBScript's Eval() function.
The code (untested mockup) may be like this
Function RunKWTest(ByVal strTestName)
' will not work if keyword test returns an object
' code must be enchanced if parameters support for keyword test is needed
RunKWTest = Eval("KeywordTests." & strTestName & ".Run")
End Function
Have a look at the native VBScript's Eval() function.
The code (untested mockup) may be like this
Function RunKWTest(ByVal strTestName)
' will not work if keyword test returns an object
' code must be enchanced if parameters support for keyword test is needed
RunKWTest = Eval("KeywordTests." & strTestName & ".Run")
End Function
Regards,
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
