Desktop Scripting - How to throw an error
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Desktop Scripting - How to throw an error
Hello! I'm brand new here! Love this tool but I must convince my company based on a proof of concept.
So, my simple question is, how do you throw an error based on your own test?
GridCellValue = Aliases.Purchasing.frmPurchasingMenu.MdiClient.frmPoShipDateMaint.pnlData.tabMain.tpgTracking.RadGroupBox5.dgvTracking.wValue(0,2) 'row, column
If GridCellValue <> "167 AAA Cooper" Then
'throw an error
End If
GridCellValue = Aliases.Purchasing.frmPurchasingMenu.MdiClient.frmPoShipDateMaint.pnlData.tabMain.tpgTracking.RadGroupBox5.dgvTracking.wValue(1,2) 'row, column
If GridCellValue <> "1234567890" Then
'throw an error
End If
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 ways :
- Javascript basis;
throw Error("This is the message of the error")
It will generate an exception and you can manage it in single endpoint with try .. catch pattern.
Note: you don't have to make throw new Error() because new is implicit.
- TestComplete basis (not really throwing error but sort of);
Log.Error("This is the message of the error")
Un sourire et ça repart
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For some additional information, the difference between throwing a Javascript error and using Log.Error() is that if you use Javascript's throw keyword you can catch those errors in a try... catch statement, which might be useful in some circumstances. Log.Error() can't be caught by a try... catch statement.
--------------------
Senior SQA Automation Engineer
