// 1. Another way to extend BELLATRIX is to use the assertions hooks. This is how the BDD logging is implemented. // For example, some of the available hooks are: // AssertExecutionTimeUnderEvent - an event executed before AssertExecutionTimeUnder method // AssertContentContainsEvent - an event executed before AssertContentContains method // AssertContentTypeEvent - an event executed before AssertContentType method // // 2. You need to implement the event handlers for these events and subscribe them. // 3. BELLATRIX gives you again a shortcut- you need to create a class and inherit the AssertExtensionsEventHandlers class // In the example, DebugLogger is called for each assertion event printing to Debug window what the method is verifying. // You can call external logging provider, modify the response, etc. The options are limitless. // // 4. Once you have created the EventHandlers class, you need to tell BELLATRIX to use it. To do so call the App service method // Note: Usually, we add the assertions event handlers in the AssemblyInitialize method which is called once for a test run. public override void TestsArrange() { App.AddAssertionsEventHandler <DebugLoggerAssertExtensions>(); // If you need to remove it during the run you can use the method bellow. ////App.RemoveAssertionsEventHandler<DebugLoggerAssertExtensions>(); }