2011-08-23 111 views
1

我可以知道如何在SilkTest中創建班級嗎?我正在使用Open Agent。 我創建了一個類:在silktest創建班級

winclass hello 
    void check() 
    print("hi") 

我把它在包括file.But每當我創建測試腳本的一個對象,我得到一個錯誤說

"hello is not a type" 

感謝

回答

0

你需要聲明你的類的一個實例,結果腳本應該看起來像這樣:

[-] 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等。