SilkTest Question:
Download Job Interview Questions and Answers PDF
Trying to create a datadriven tests
Answer:
Trying to create a datadriven tests. Placed the .xls file in a data folder. The script should connect to the .xls file, open the file, read the contents in the .xls file and fill the form with the values. I have written some steps using the Help guide. Its not working i get errors Can any one suggest me the list of steps and in which folder these steps should go.
The following error:
C:Program FilesSegueSilkTestexamplesframe .inc(2): Window class BrowserChild is not defined or ambiguous
Database connectivity - Found word(s) list error in the Text body
the following error now:
Error: Variable (frmCompanyName) has not been set
Also I did the variable declaration as follows
[-] testcase DD_Test1 (REC_DATALIST_DD_Test1 rData)
[ ] STRING frmCompanyName
[ ] STRING Phone
[ ] STRING Contact
[ ] STRING Title
[ ] STRING Insights
[ ] STRING CoInsights
This looks like more of a scoping issue in Silktest than a problem with any DB connection to an excel file. Since I am heading out the door in just a few, I will have to take a closer look at this tommorow but typically, my data driven scripts are structured sort of like:
[ ] //this reads the data from the spreadsheet and then iterates
[ ] use "P:Silkauincludesautoarch_temp.inc"
[ ]
[-] main()
[ ] HANDLE hDB
[ ] HANDLE hSQL
[ ] STRING sFirstName, sLastName, sAddress, sEmail, sComment, sExpected, sItem
[ ] INTEGER iCase, iPF, iRun
[ ] LIST OF STRING lsCases
[ ] STRING sQuery = "Select * from `Sheet1$`"
[ ] //open spreadsheet:
[ ] hDB = DB_connect ("DRIVER=Microsoft Excel Driver (*.xls);DBQ=P:QARelease11.1AUAutomationcontact_validation_words11_ 1.xls; READONLY=FALSE")
[ ] hSQL = DB_ExecuteSQL(hDB, sQuery)
[-] while DB_FetchNext(hSQL, iCase, sFirstName, sLastName, sAddress, sEmail, sComment, sExpected, iPF, iRun)
[ ] //print("{iCase} {sFirstName} {sLastName} {sAddress} {sEmail} {iRun}")
[-] if iRun == 1
[ ] ListAppend(lsCases, "{iCase}|{sFirstName}|{sLastName}|{sAddress}|{sEmail}|{sComment}|{sExpec ted}|{iPF}|{iRun}")
[ ]
[ ] DB_FinishSql (hSQL)
[ ]
[-] for each sItem in lsCases
[ ] TestContactInfo(sItem, hDB)
[ ]
[ ]
[ ]
[ ] DB_Disconnect(hDB)
[ ]
//-----------------------------------------------------------
[-] testcase TestContactInfo(STRING sTest, HANDLE hDB optional)
[ ] //logic to feed the functions and methods to run the cases and determine pass/fail.
[ ] //can even write results to the same excel file, if need be.
And of course, there are going to be plenty of people out there with var. setups (plans, suites...)
The following error:
C:Program FilesSegueSilkTestexamplesframe .inc(2): Window class BrowserChild is not defined or ambiguous
Database connectivity - Found word(s) list error in the Text body
the following error now:
Error: Variable (frmCompanyName) has not been set
Also I did the variable declaration as follows
[-] testcase DD_Test1 (REC_DATALIST_DD_Test1 rData)
[ ] STRING frmCompanyName
[ ] STRING Phone
[ ] STRING Contact
[ ] STRING Title
[ ] STRING Insights
[ ] STRING CoInsights
This looks like more of a scoping issue in Silktest than a problem with any DB connection to an excel file. Since I am heading out the door in just a few, I will have to take a closer look at this tommorow but typically, my data driven scripts are structured sort of like:
[ ] //this reads the data from the spreadsheet and then iterates
[ ] use "P:Silkauincludesautoarch_temp.inc"
[ ]
[-] main()
[ ] HANDLE hDB
[ ] HANDLE hSQL
[ ] STRING sFirstName, sLastName, sAddress, sEmail, sComment, sExpected, sItem
[ ] INTEGER iCase, iPF, iRun
[ ] LIST OF STRING lsCases
[ ] STRING sQuery = "Select * from `Sheet1$`"
[ ] //open spreadsheet:
[ ] hDB = DB_connect ("DRIVER=Microsoft Excel Driver (*.xls);DBQ=P:QARelease11.1AUAutomationcontact_validation_words11_ 1.xls; READONLY=FALSE")
[ ] hSQL = DB_ExecuteSQL(hDB, sQuery)
[-] while DB_FetchNext(hSQL, iCase, sFirstName, sLastName, sAddress, sEmail, sComment, sExpected, iPF, iRun)
[ ] //print("{iCase} {sFirstName} {sLastName} {sAddress} {sEmail} {iRun}")
[-] if iRun == 1
[ ] ListAppend(lsCases, "{iCase}|{sFirstName}|{sLastName}|{sAddress}|{sEmail}|{sComment}|{sExpec ted}|{iPF}|{iRun}")
[ ]
[ ] DB_FinishSql (hSQL)
[ ]
[-] for each sItem in lsCases
[ ] TestContactInfo(sItem, hDB)
[ ]
[ ]
[ ]
[ ] DB_Disconnect(hDB)
[ ]
//-----------------------------------------------------------
[-] testcase TestContactInfo(STRING sTest, HANDLE hDB optional)
[ ] //logic to feed the functions and methods to run the cases and determine pass/fail.
[ ] //can even write results to the same excel file, if need be.
And of course, there are going to be plenty of people out there with var. setups (plans, suites...)
Download SilkTest Interview Questions And Answers
PDF