Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Tests to Core3.1 #5

Merged
merged 1 commit into from
Nov 13, 2020
Merged

Conversation

AlanGraham
Copy link

Core3.1 has LTS.
-you could consider changing to .Net5.0 but will need changes to your CI/CD.
Update nuget packages.
Ran Test coverage and dotnet-stryker (https://github.com/stryker-mutator/stryker-net).
-quite low test coverage
-mutation testing with stryker showed a number of areas tests don't cover
-format of tests was not one I'm familiar with and mostly in German so bit of a barrier to submit for now

Cool project - was wrestling with a problem last night and realised Fractions may be the fix.
Had a look and saw this existed, so will try and use to see if it helps :)

Core3.1 has LTS.
-you could consider changing to .Net5.0 but will need changes to your CI/CD.
Update nuget packages.
Ran Test coverage and dotnet-stryker (https://github.com/stryker-mutator/stryker-net).
-quite low test coverage
-mutation testing with stryker showed a number of areas tests don't cover
-format of tests was not one I'm familiar with and mostly in German so bit of a barrier to submit for now

Cool project - was wrestling with a problem last night and realised Fractions may be the fix.
Had a look and saw this existed, so will try and use to see if it helps :)
@AlanGraham
Copy link
Author

Had meant to merge to the Main on my fork first, can't see where in files in fork to change the CI to use 3.1 instead of 2.2

@danm-de
Copy link
Owner

danm-de commented Nov 13, 2020

Cool, thanks. I'll have a look at the CI/DI pipeline.

@danm-de danm-de merged commit cd1e253 into danm-de:master Nov 13, 2020
@danm-de
Copy link
Owner

danm-de commented Nov 13, 2020

I've just checked the code-coverage:

image

I don't know how to convince Resharper's unit test coverage tool to run the tests for all frameworks (Fractions is a multi-target project). However, 71% is not that bad ;-)

@danm-de
Copy link
Owner

danm-de commented Nov 13, 2020

Unit-Test format is basically AAA (Arrange, Act, Assert). Sometimes a Spec base class is used. The virtual methods

  • Arrange() or SetUp()
  • Act()

are self-describing (I think). The public [Test] method is the assertion step. NUnit's TestCaseSource feature is used as well to simplify / minimize code.

I tried to name the classes and methods to read the test results like this:

   If something happens ... <class name>
     When it should ... <test method name>

I guess the tests would have been more readable if I had used https://specflow.org/ at the beginning.

Sorry for the Germany language in some of the unit tests ;-)

@AlanGraham
Copy link
Author

Ah yeah I'd used the inbuilt VS code coverage tool which gives similar results (https://docs.microsoft.com/en-gb/visualstudio/test/using-code-coverage-to-determine-how-much-code-is-being-tested?view=vs-2019 but looks like it's only in Enterprise :( )

CodeCoverage

The mutation report does a better job of showing the gaps in testing.

MutationReport
image

I'm still working on the issue that made me look into Fraction, so once I get as far as I can go, I'll come back to this and maybe spend some time looking more at the tests. I think the first once I'd tried to look at was overriding methods in your Spec class, using Test Sources and not in a language I speak so I didn't want to spend too long trying to understand it before I continued on the tasks I am on. I'm probably more used to https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-nunit style

@AlanGraham AlanGraham deleted the agraham/update branch November 13, 2020 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants