nHapi icon indicating copy to clipboard operation
nHapi copied to clipboard

Improve Test Coverage

Open milkshakeuk opened this issue 4 years ago • 2 comments

Of course, test coverage is not a measure of quality, however it does give you an idea of how much of the code is tested.

To that end the test coverage needs to be increased so any help adding tests would be very grateful.

milkshakeuk avatar Feb 15 '21 09:02 milkshakeuk

I find Codacy being bad at visualizing where tests are needed. Could either the generated files be ignored so we can use it to get a good overview or do you have any opinion on where tests are most needed?

fredrikcarlbom avatar Feb 28 '22 22:02 fredrikcarlbom

@fredrikcarlbom for now I would look to add unit tests for the non source-generated projects, depending on your IDE and or IDE plugins you can get a good view of the coverage (I agree codacy doesn't visualise this very well).

If you use rider it has build in coverage, if you use VisualStudio with resharper this is also included.

image

Otherwise you can run a few commands to generate a report.

dotnet test nhapi.sln --collect:"XPlat Code Coverage" -r TestResults

Then use this dotnet tool to generate a html report which allows you to drill into the details, which looks something like this:

image

milkshakeuk avatar Mar 01 '22 08:03 milkshakeuk