获取 VB 脚本的当前子名称

发布于 2024-08-14 18:48:09 字数 247 浏览 5 评论 0 原文

我正在开发用于 GUI 测试的 VBscript。我想知道是否有可能获得当前的子名称。

我已将 GUI 测试划分为不同的 Sub,并希望将 Sub 名称记录到 logg 文件中以跟踪运行的内容。

所以这就是我想要的

Sub TestCase1
 Log.Message(SubName)

 ' Rest of test
End Sub

通过使用它我没有将子名称硬编码为文本字符串

I am developing VBscript for GUI testing. And I wonder if there is possibilites to get the current Sub name.

I have divied the GUI testing into different Sub and want to log the Sub name to the logg file to track what is run.

So this i that I want

Sub TestCase1
 Log.Message(SubName)

 ' Rest of test
End Sub

By using this I don't have the sub name hardcoded as a text string

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美人骨 2024-08-21 18:48:09

VBScript(与 JScript 不同)不提供任何获取当前例程名称的方法。

您需要的是将脚本例程作为 测试项目 运行(您正在使用 TestComplete,对吧?) — 在这种情况下,您将获得一个树状日志,其中包含按脚本例程分组的消息。
您还可以通过 Project 以编程方式访问测试项目.TestItems 对象。例如,您将能够使用 Project.TestItems.Current.ElementToBeRun.Caption 属性。

VBScript (unlike JScript) doesn't provide any means to get the current routine name.

What you need is to run your script routines as test items (you're using TestComplete, right?) — in this case you'll get a tree-like log with messages grouped by script routines.
You'll also be able to access the test items programmatically via the Project.TestItems object. For example, you'll be able to get the name of the current script routine that is run as a test item using the Project.TestItems.Current.ElementToBeRun.Caption property.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文