views:

302

answers:

2

I am doing regression testing using NUnit, WatiN and VB.net. What i am doing is opening an IE page, seleting some data, making a registration and then on view registration page testing the registration by assertion.

I want to ask is it a good way to use try and catch on every assert. i am using it because if some assert fails it will stop executing the rest of the statement and quits without running rest of the tests. Now I have put try and catch on every assert and writting the fail message in log file. Kindly let is it ok to go with this approach or suggest any better one.

Hello Ray

For instance If I am checking for some airline resevation booking. After creating a booking, On view Booking Summary Page I am testing weather it is diplaying cancel booking button or not. For this I am ussing the following code Try Assert.IsTrue(_internetExplorer.Button(Find.ById(New Regex("CBooking"))).Exists) Catch ex As Exception d_logger.LogResultTextFile("Cancel Button doesnot Exist", True, False) End Try I am checking this by running this in a loop for no of bookings created. I want to keep running the test even if in one booking it wont finds the button but keep checking for other bookings. Thats why I am using it. What I want is is iit a good approach to do so or not

+1  A: 

Hi Sam

This should be the case. If one Assert fails in your test, no other asserts should happen either. The best way is to run your tests, fix the assert that failed and run again.

Ray Booysen
A: 

did as Directed

sam
This does not appear to be an answer. If this is more of your question, then update your question and delete this non-answer.
S.Lott