开发者

create a class in silktest

May I know how to create a class in SilkTest?I am using Open Agent. I created a class:

winclass hello
  void check()
     print开发者_运维问答("hi")

I included it in the include file.But whenever i create an object for it in Test Script,I get an error saying

"hello is not a type"

Thanks


You need to declare an instance of your class, the resulting script should look something like that:

[-] 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()

This will print "Hello World". You can also have more instances, like helloWindow1, helloWindow2, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜