Negative test - second iteration
QTP 9.0 with Oracle and Java addins
Win XP sp 2
Scripting an Oracle app
Simulate a data entry clerk logging in once, entering multiple orders for multiple clients, saving to the database once per each client. Then logging out.
I have data in an external excel file, which I import into QTP’s Global datatable.
I got the import to work fine, I also got the multiple iteration issue worked out. Now I want to test how QTP handles empty rows, in excel, where it expects data to be. (Negative Testing)
All works fine if I set QTP up to run for two iterations and I have provided data in excel for two customer numbers (two rows of valid data under column "Customer_Num"), but it fails if there is only one customer number.
Code I am using for the second iteration:
'CREATE A SECOND CUSTOMER
'Create a second new record with a new Customer number.
OracleFormWindow("Sales Order").SelectMenu "File->New"
'Check the Global datasheet to see if there are any more Customer Numbers before
DataTable.ImportSheet "C:\QOE Data - UAT1.xls" ,"Data" ,"Global"
Dim rowCount2, val2, sValue
For i=2 to rowCount2
If (val2)="" Then
Browser("Browser").Page("Oracle Applications 11i").Sync
'Continue your steps if data is not blank
If i = 2 Then
OracleFormWindow("Sales Order").OracleTabbedRegion("Order Information").OracleTextField("Customer Number").SetFocus
OracleFormWindow("Sales Order").OracleTabbedRegion("Order Information").OracleTextField("Customer Number").Enter val2
Can you tell me what is wrong with my code?
Re: Negative test - second iteration
What does work:
One row of data
What doesn't work:
Two rows of data
I placed a msg box on the second iteration. It pops up and gives the data from the second row, which is correct. But after I click OK on the msg box, it pops up again and is blank (must be reading the third row which is blank, but there is only one msg box in my script, not two). I click OK and then it exits the QTP script.
What I expect:
Since I have only two rows of data, after clicking OK on the msg box that displays the correct second number, I want QTP to finish it's task, instead of exiting the script altogether.