One of the cool items I didn’t mentioned in my announcement post is that we now have the ability to integrate screenshots from a WatiN test into the reports.
Here we have a simple test which searches for MbUnit on Google and then asserts to check that NUnit is mentioned on the page (this fails).
public void DemoCaptureOnFailure()
using (Log.BeginSection(“Go to Google, enter MbUnit as a search term and click I’m Feeling Lucky”))
// Of course this is ridiculous, we’ll be on the MbUnit homepage…
Assert.IsTrue(ie.ContainsText(“NUnit”), “Expected to find NUnit on the page.”);
Normally, it would be hard to find out what was actually on the webpage at that point to see why the test decided to fail. In the tear down method, there is a check if the test passed or failed, if it failed then it takes a snapshot and includes it in the report.
public void DisposeBrowser()
if (Context.CurrentContext.Outcome == TestOutcome.Failed)
Snapshot(“Final screen when failure occurred.”, LogStreamNames.Failures);
if (ie != null)
When you view the report, on the test that failed you can see that the screenshot of the webpage has been included. This will make debugging the error a lot easier, making the tests more useful.
I think this is a great feature, well done to Jeff and the team for implementing this.