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

New article that details unit test code coverage using coverlet #18955

Merged
merged 17 commits into from
Jun 17, 2020

Conversation

IEvangelist
Copy link
Member

@IEvangelist IEvangelist commented Jun 15, 2020

Summary

Adding new article that details unit test code coverage using coverlet.

  • Adjust next steps in existing article
  • Add "code coverage" section to best practices
  • New articles detailing coverlet and dotnet test --collect:"Data Collector"
  • Update ToC

Fixes #1477, and fixes #17255

Preview

✔️     NEW: Use code coverage for unit testing
✔️     UPDATE: Unit testing best practices with .NET Core and .NET Standard

@IEvangelist IEvangelist self-assigned this Jun 15, 2020
@IEvangelist IEvangelist marked this pull request as ready for review June 15, 2020 16:10
@IEvangelist IEvangelist requested a review from a team as a code owner June 15, 2020 16:10
@IEvangelist IEvangelist requested a review from BillWagner June 15, 2020 16:14
Copy link
Contributor

@tdykstra tdykstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, I just had some suggestions to change wording here and there, include some guidance on choosing among alternatives, and include some output examples.

docs/core/testing/unit-testing-best-practices.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-best-practices.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
Co-authored-by: Tom Dykstra <tdykstra@microsoft.com>
@IEvangelist IEvangelist marked this pull request as draft June 15, 2020 18:54
@IEvangelist IEvangelist marked this pull request as ready for review June 16, 2020 15:31
@IEvangelist
Copy link
Member Author

Ping @tdykstra and @BillWagner - I flipped this back over to "ready for review". I've made huge updates to it, since it was approved from Tom initially.

@tdykstra
Copy link
Contributor

I'll take another look this afternoon.

Copy link
Contributor

@tdykstra tdykstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the tutorial format, I wonder if a further structural change would be useful -- right now the directions have them doing 2 unit test projects and include partial instructions for a 3rd. As a tutorial, it might work better as 3 , that is, up front give the three options and tell how to choose, then have a separate sequence of instructions for each choice. That way they get to follow instructions fully covering their chosen approach while not having to do steps that pertain to an approach that is irrelevant for them.

docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
The *MSBuild* project is named appropriately, as it will depend on the [coverlet.msbuild](https://www.nuget.org/packages/coverlet.msbuild) NuGet package. Add this package dependency by running the [`dotnet add package`](../tools/dotnet-add-package.md) command:

```dotnetcli
cd XUnit.Coverlet.MSBuild\ && dotnet add package coverlet.msbuild && cd ..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this method of including line breaks work equally well in PowerShell, CMD, on Linux, and on macOS? If not it might be better to create a separate block for each command.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no line breaks, just && and cd commands. Both of which are cross platform.

docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
docs/core/testing/unit-testing-code-coverage.md Outdated Show resolved Hide resolved
@IEvangelist IEvangelist merged commit cfdd645 into dotnet:master Jun 17, 2020
@IEvangelist IEvangelist deleted the unit-test-coverage branch June 17, 2020 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants