As I was updating my code sample for ReportUnit, I discovered that this little helper is not being developed any longer. I wrote about ReportUnit in 2017 and used it since then to generate an overview for my test suites. Let us see if there is an alternative worth migrating to.
The successor
If you visit the GitHub repo for ReportUnit you see this message about the state of the project and its replacement:
ReportUnit is not maintained and will be replaced by extentreports-dotnet-cli. The new CLI allows integration with the Extent Framework which has a host of existing reporters which are actively maintained along with the framework’s report server Klov.
The Extent .NET CLI project is at version v0.0.3 and got its last updated 9 months ago. Not the best first impression, but I decided to try it and see for myself how well it works and what got this tool its nearly 59,000 downloads on NuGet.
Installation
As with ReportUnit you can install Extent in one project and then use it in a batch file. The project does not matter, but I prefer to install it in a test project:
1 |
PM> Install-Package extent |
Switch from ReportUnit to Extent
For ReportUnit I use this cmd file that runs NUnit for all my test projects and at the end creates the HTML report:
1 2 3 4 5 6 |
del ".\HTMLReport\*.html" ".\packages\NUnit.ConsoleRunner.3.6.1\tools\nunit3-console.exe" ".\Reports.Core.Tests\bin\Debug\Reports.Core.Tests.dll" --result="Reports.Core.Tests.xml;format=nunit3" --work=".\TestResults" ".\packages\NUnit.ConsoleRunner.3.6.1\tools\nunit3-console.exe" ".\Reports.Helper.Tests\bin\Debug\Reports.Helper.Tests.dll" --result="Reports.Helper.Tests.xml;format=nunit3" --work=".\TestResults" ".\packages\NUnit.ConsoleRunner.3.6.1\tools\nunit3-console.exe" ".\Reports.Import.Tests\bin\Debug\Reports.Import.Tests.dll" --result="Reports.Import.Tests.xml;format=nunit3" --work=".\TestResults" ".\packages\ReportUnit.1.2.1\tools\ReportUnit.exe" ".\TestResults" ".\HTMLReport" |
For the migration I only needed to replace the call to the tool and change the arguments (all in the last line):
1 2 3 4 5 6 |
del ".\HTMLReport\*.html" ".\packages\NUnit.ConsoleRunner.3.6.1\tools\nunit3-console.exe" ".\Reports.Core.Tests\bin\Debug\Reports.Core.Tests.dll" --result="Reports.Core.Tests.xml;format=nunit3" --work=".\TestResults" ".\packages\NUnit.ConsoleRunner.3.6.1\tools\nunit3-console.exe" ".\Reports.Helper.Tests\bin\Debug\Reports.Helper.Tests.dll" --result="Reports.Helper.Tests.xml;format=nunit3" --work=".\TestResults" ".\packages\NUnit.ConsoleRunner.3.6.1\tools\nunit3-console.exe" ".\Reports.Import.Tests\bin\Debug\Reports.Import.Tests.dll" --result="Reports.Import.Tests.xml;format=nunit3" --work=".\TestResults" ".\packages\extent.0.0.3\tools\extent.exe" -d ".\TestResults" -o ".\HTMLReportExtent" -r v3html --merge |
The --merge
option was the biggest challenge. Without this option you get a report, but it does not include all tests. It is all described in the documentation, yet somehow I missed it.
The report
With my script I can create a report like this one:
It contains an overview where I can see the number of tests files and test cases. Unfortunately, the naming is a bit off and test files are called tests while test cases are named steps.
The report is not only for show. You can use filters to quickly find failed tests and see the reason directly in the report:
Downsides
What I miss the most is the Executive Summary page from ReportUnit that lists all your test projects and shows how many tests you have and in what state:
This screen was the reason I used ReportUnit in the first place, because I wanted all those details in one single report. The counterpart in Extent is rather useless for me.
The most annoying part of the Extent report for me is the constantly changing colour scheme for the timeline in the Dashboard. Every time I open the report it uses another colour combination to show the projects and how much time was spent there:
This behaviour does not add any value and I lose a lot of time to find what I am looking for.
Should you switch?
Extent is an interesting project and, despite the low version number, offers most of the ReportUnit features. If you can live with the downsides I wrote about then go ahead and try it with one of your test suites.
I for one will wait for a higher change frequency in the repository and the fix of the colour assignment before I consider switching to Extent. However, a similar view like the Executive Summary could swiftly change my mind.