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

Added an override that allows for a time stamp to be set whilst logging #44

Open wilfglover opened 7 years ago

wilfglover commented 7 years ago

This idea came from wanting to only create a test report if the test fails, so we would store the test details locally then flush them out at the end of the test. This would have the time stamp being inaccurate since datetime.now is always used. This override allows for the time stamp to be stored along side the test details and flushed with it at the end of a test.

anshooarora commented 7 years ago

I don't think its a good approach to provide this option inside a constructor. I would rather do it via a property or a method, or directly use the intrinsic model to access this and other properties.

// approach 1
extentTest.StartTime = DateTime.Now;

// approach 2:  use intrinsic model
extentTest.GetModel().StartTime = DateTime.Now;