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

docs: adding coverage walkthroguh #14688

Merged
merged 2 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ versioning guidelines:

Please see [support/README.md](support/README.md) for more information on these hooks.

* Create your PR.
* Create your PR. If your PR adds new code, it should include tests [covering](source/docs/coverage.md) the new code.
* Tests will automatically run for you.
* We will **not** merge any PR that is not passing tests.
* PRs are expected to have 100% test coverage for added code. This can be verified with a coverage
Expand Down
Binary file added source/docs/aclick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/click.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions source/docs/coverage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
### How can I tell if my new code is covered by tests?

In a PR run, for example https://github.com/envoyproxy/envoy/pull/14672

Click on the check mark or X for the CI results you want to look at. Generally
this will be the last run, but for this example we’ll pick an earlier, failed
run.

![PR view](pr_view.png)

Next, click on the “Details” link on the coverage run. If the run was a success
you may need to scroll down to see the coverage build.

![click coverage](click.png)

Next up, click on the warnings/errors link. For a successful coverage run, this will list zero errors/warnings but will still be clickable

![click error](eclick.png)

On the azure results page, again click through to see results.

![azure error](aclick.png)

![coverage results](results.png)


In this case the error reason was clear, and the directory missing coverage is listed. To get an understanding of what lines aren’t covered, you can browse further.

Scroll down on the left, and click on “Upload coverage reports”
This will provide a link on the right, telling you where the coverage
upload went, in this case a link to
“https://storage.googleapis.com/envoy-pr/269d783/coverage/index.html” (which
will only be valid for some number of days).

![coverage upload](upload.png)

Clicking on the link provides a full color-annotated coverage report

![coverage report](report.png)

You can browse this report to the directory in question. In this particular
case the coverage issue was actually a coverage bug, where trailing braces in
tested switch statements are considered uncovered lines. Generally this will
instead provide a branch of code which simply needs unit tests.

![coverage file](file.png)



Binary file added source/docs/eclick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/pr_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.