How to convert NUnit output into an HTML report

ReportUnit is not maintained and is being replaced by extentreports-dotnet-cli. You can also try ReportUnit, which also supports Gallio, xUnit, TestNG and MSTest: http://reportunit.relevantcodes.com This is a simple exe file that will convert your xml report into an HTML dashboards (samples): Folder-level dashboard: http://relevantcodes.com/Tools/ReportUnit/Index.html File-level: http://relevantcodes.com/Tools/ReportUnit/NUnit-TestResult.html Usage: reportunit “path-to-folder” // folder-level report reportunit “path-to-folder” “output-folder” … Read more

Ignore Test or TestFixture based on a condition

Use some code in your test or fixture set up method that detects if the simulation software is installed or not and calls Assert.Ignore() if it isn’t. [SetUp] public void TestSetUp() { if (!TestHelper.SimulationFilesExist()) { Assert.Ignore( “Simulation files are not installed. Omitting.” ); } } or [TestFixtureSetUp] public void FixtureSetUp() { if (!TestHelper.SimulationFilesExist()) { Assert.Ignore( … Read more

Using NUnit to test for any type of exception

The help for Assert.Throws<> states that it “Verifies a delegate throws a particular type of exception when called” Try the Assert.That version as it will catch any Exception: private class Thrower { public void ThrowAE() { throw new ArgumentException(); } } [Test] public void ThrowETest() { var t = new Thrower(); Assert.That(() => t.ThrowAE(), Throws.Exception); … Read more

How does nunit successfully wait for async void methods to complete?

A SynchronizationContext allows posting work to a queue that is processed by another thread (or by a thread pool) — usually the message loop of the UI framework is used for this. The async/await feature internally uses the current synchronization context to return to the correct thread after the task you were waiting for has … Read more

Moving existing code to Test Driven Development

See the book Working Effectively with Legacy Code by Michael Feathers. In summary, it’s a lot of work to refactor existing code into testable and tested code; Sometimes it’s too much work to be practical. It depends on how large the codebase is, and how much the various classes and functions depend upon each other. … Read more