Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top