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

Feature request: add nested entries #100

Open arnonax opened 6 years ago

arnonax commented 6 years ago

Often operations are composed from more low-level operations in a nested way (as higher level methods call lower level ones, etc.). If we log all the details of the low-level methods it is hard to see the big picture, but if we don't log these, then we may miss important information that we need to investigate failures.

For this reason I want to be able to create log entries that can be nested. The high-level method will log a special entry which starts a nested section when it starts, and end the section when it ends (using IDisposable and the using keyword can make it very easy). Any log entries that will be written between them will be nested between them. Of course that nesting can be recursive...

On the generated report the user should be able to collapse and expand nested sections to start from the big-picture and drill down to details as needed during the investigation of a failure.

Note: I created the simple nested logging mechanism in Test Automation Essentials (See the test StartSectionAutomaticallyIncreasesTheIndentationForTheSection here to get the idea), but its default implementation only writes to the console output and uses indentation to distinguish between the layers. I wanted to create an ExtentReport adapter, but I need this nesting feature in order to make it useful.

anshooarora commented 6 years ago

I am building the template using RazorEngine. I am not sure if it supports recursion to allow dynamic number of nested elements. Feel free to send in a pull request, I will merge.