anshooarora / extentreports-csharp

Community version of Extent API for .NET has moved to https://github.com/extent-framework/
http://extentreports.com/
Other
47 stars 43 forks source link

Does Extent Reports log failures on timeout/element not found or just asserts? #113

Closed jamesaslett1985 closed 6 years ago

jamesaslett1985 commented 6 years ago

As per the title. If my code is:

[Test] public void DemoReportFail() { var test = extent.CreateTest("DemoReportFail"); Assert.IsTrue(false); test.Fail("Assert Fail as condition is false"); }

I presume that test.Fail is what actually logs the outcome as a fail, but what if I had a test like this:

[Test] public void DemoReportFail() { var test = extent.CreateTest("DemoReportFail"); Driver.Instance.FindElement(By.Id("foo")); test.Pass("Assert Pass"); }

If the test fails because the ID "foo" cannot be found, can I log this as a failure? At present my test case is passing when I want it to fail with a message informing me that ID "foo" cannot be found.

Forgive me if this is basic, I am very new to this!

anshooarora commented 6 years ago

It will log everything if you set it up so. See here for example and the NUnit hooks used to trap any exception thrown at runtime.