Contributions
Re: Issue with Data-Driven Loop, script is not gracefully exiting on error
Hi rraghvani, Based on your suggestion I've tweaked my code. I've removed Try and Except block and used the OnLogError event to handle the error. I've added a project variable to increase error count ( we can not reset Log.errCount value), based on this project variable value I'm making the decision to exit the loop or to enter another function in the loop. I'm resetting this project variable value at the start of every test case. Thanks, Diwakar456Views0likes0CommentsRe: Issue with Data-Driven Loop, script is not gracefully exiting on error
Hi Chris, Thanks for looking into this issue. Actually, I've already tried that approach however no luck. What is happening here, if there are 10 objects on a page, and an error occurred at the second object then the script marks the step as a failure but at the same time it continues to perform the action on other objects on the page, it should skip that iteration completely and pick another in a loop. If you have any other solution to achieve this please let me know, I'll tweak my code accordingly.1.6KViews0likes0CommentsRe: Issue with Data-Driven Loop, script is not gracefully exiting on error
Marsha, I tried to use another Next in except block but no luck. I've uploaded the code and test data file for your reference. Please change the TestDataPath variable value. There are 3 rows in the test data file, each is treated as a different Test case.1.6KViews0likes2CommentsIssue with Data-Driven Loop, script is not gracefully exiting on error
We have a requirement to create multiple accounts. All the test data are being passed from an excel sheet, for that a data-driven loop is used. Each row in the Excel sheet is treated as a different test case. Issue Detail:- If one test case failed due to test data or any other issue, the script should mark that particular test case( row of an excel sheet) as failed and should pick the next row for execution. The problem is here that if the Playback setting is set as Continue on error, then in this case script is not exiting that case and continuing with the next steps. If we set "Stop current item" in the playback setting, its moves to the next test case but the script is not entering any values in the next case and getting failed due to the "Operation interrupted by the user" error, and all the further test cases also got failed due to similar issues. Please suggest a way to resolve this issue. Thanks Sample Code for reference code is similar to below dataVar=DDT.ExcelDriver("c:\data\testdata.xls","Account",True) while not dataVar.EOF(): try: aqTestCase.Begin(dataVar.Value[1]) login() fillDataInAccountForm(dataVar) logoff() aqTestCase.End() except Exception as e: Log.error("Error Occured"+str(e)) dataVar.next()2.2KViews0likes13CommentsRe: Issue with Data-Driven Loop, script is not gracefully exiting on error
Hi Marsha_R, Thanks for looking into this issue. We are expecting all data to be worked however during execution some may fail in validation. In a failure scenario, our expectation is to fail that particular test case and pick the next in the row. Thanks, Diwakar1.7KViews0likes4Comments