Interview Questions

Expain about data driven testing using silktest

SilkTest Questions and Anwsers


(Continued from previous question...)

99. Expain about data driven testing using silktest

1) Create an .xls containing the data required in the script such as username and password for this example
2) In Silk select Workflow -> Data Driven
3) Select Data Driven Test Case (after you create your testcase) Following the wizard browsing to the .xls file containing your data when prompted. This creates the DSN automatically for you. Accept rest of defaults barring you required naming conventions
4) In you script then code your method as say for example:
[CODE]
testcase DataDrivenExample () appstate DefaultBaseState
[ ]
[ ] Browser.Maximize()
[ ]
[ ] // If the Logon page is not displayed Load it.
[-] if (!LoginPage.Exists())
[ ] Browser.LoadPage("{kProtocol}://{kWebServer}:{kPort}/logon.jsp")
[ ]
[ ] LoginPage.LoginUser (User, Password)
[ ] ApplicationHome.Exists(kPageTimeOut)
[ ] ApplicationHome.SetActive()
[\CODE}

Now highlight your variable User say first and from the column drop down list on the replace pan select your UserName column(that is been linked to your spreadsheet, this is all automatically done) and select Replace button, do the same for the rest of your required data. Notice the DATA DRIVEN ASSISTANT SECTION is automatically generatign code. This is a good way to start off anyways, hope it's been of some help, simple xls sheet attached but only expremely basic one
Below is what Code migth look like after Replace is selcted
[CODE]
testcase DataDrivenExample (REC_DATALIST_DD_DataDrivenExample rData) appstate DefaultBaseState
[ ]
[ ] Browser.Maximize()
[ ]
[ ] // If the Logon page is not displayed Load it.
[-] if (!LoginPage.Exists())
[ ] Browser.LoadPage("{kProtocol}://{kWebServer}:{kPort/logon.jsp")
[ ]
[ ] LoginPage.LoginUser (rData.recSheet1_.User, rData.recSheet1_.Password)
[ ] ApplicationHome.Exists(kPageTimeOut)
[ ] ApplicationHome.SetActive()

[\CODE]

(Continued on next question...)

Other Interview Questions