Automation 在silktest中创建一个类

Automation 在silktest中创建一个类,automation,silktest,Automation,Silktest,我可以知道如何在SilkTest中创建一个类吗?我正在使用OpenAgent。 我创建了一个类: winclass hello void check() print("hi") 我将它包含在include文件中,但每当我在测试脚本中为它创建一个对象时,我都会收到一个错误消息 "hello is not a type" 谢谢您需要声明类的实例,生成的脚本应该如下所示: [-] winclass hello [-] void check() [ ] prin

我可以知道如何在SilkTest中创建一个类吗?我正在使用OpenAgent。 我创建了一个类:

winclass hello
  void check()
     print("hi")
我将它包含在include文件中,但每当我在测试脚本中为它创建一个对象时,我都会收到一个错误消息

"hello is not a type"

谢谢

您需要声明类的实例,生成的脚本应该如下所示:

[-] winclass hello
    [-] void check()
        [ ] print("Hello world")
[ ] 
[ ] 
[-] window hello helloWindow
    [ ] // this is where you tell silktest how to find helloWindow in your application, for example with an xpath locator
    [ ] 
    [ ] 
[-] testcase foo() appstate none
    [ ] helloWindow.check()
这将打印“Hello World”。您还可以有更多的实例,如helloWindow1、helloWindow2等