开发者

create a class in silktest

开发者 https://www.devze.com 2023-03-30 06:48 出处:网络
May I know how to create a class in SilkTest?I am using Open Agent. I created a class: winclass hello void check()

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

精彩评论

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

关注公众号