Skip to content

Commit a442b53

Browse files
committed
Update coverage documentation
1 parent 8386a9a commit a442b53

File tree

5 files changed

+3
-16
lines changed

5 files changed

+3
-16
lines changed

docs/images/coverage-render.png

16.6 KB
Loading

docs/images/coverage-report.png

27.7 KB
Loading

docs/images/coverage-run.png

4.68 KB
Loading

docs/test-coverage.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22

33
Test coverage is a measurement of how much of your code is tested by your tests. It defines how many lines of code were actually run when you ran your tests and how many were not. When a line of code is not run by your tests it will not have been tested and perhaps you need to extend your tests.
44

5-
The Swift extension has an option to run your tests and record what code has been hit or missed by your tests.
5+
The Swift extension integrates with VSCode's Code Coverage APIs to record what code has been hit or missed by your tests.
66

77
![](images/coverage-run.png)
88

9-
Once this is run an overview report will be displayed listing all the source files in your project and how many lines were hit by tests, how many lines were missed, how lines of source code there is in total and a percentage of those that were hit. You can click on each file to open that file in Visual Studio Code. If you close the report you can always get it back by running the command `Show Test Coverage Report`. There is also a setting `Coverage: Display Report after Run` to control whether the test coverage report is shown immediately after running tests.
9+
Once you've performed a code coverage run a coverage report will be displayed in a section of the primary side bar. This report lists all the source files in your project and what percentage of lines were hit by tests. You can click on each file to open that file in the code editor. If you close the report you can always get it back by running the command `Test: Open Coverage`.
1010

1111
![](images/coverage-report.png)
1212

13-
If you would like a more detailed view of the results there is a command `Toggle Display of Test Coverage Results` to toggle an in editor view of the coverage results. This will color the background of hit and missed lines of code with different colours. By default a hit line of code gets a green background and a missed line get a red background, although these are editable in the settings.
13+
After generating code coverage lines numbers in covered files will be coloured red or green depending on if they ran during the test run. Hovering over the line numbers shows how many times each line was run. Hitting the "Toggle Inline Coverage" link that appears when hovering over the line numbers will keep this information visible.
1414

1515
![](images/coverage-render.png)
16-
17-
An additional UI status item is displayed in the status bar at the bottom of the screen showing the hit percentage for the currently open file. This status item can be set to be always visible or only when coverage information is available. If you have it set to be visible all the time it can be used as a button to toggle the display of the in editor coverage results.
18-

package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,6 @@
160160
"title": "Insert Function Comment",
161161
"category": "Swift"
162162
},
163-
{
164-
"command": "swift.showTestCoverageReport",
165-
"title": "Show Test Coverage Report",
166-
"category": "Swift"
167-
},
168-
{
169-
"command": "swift.toggleTestCoverage",
170-
"title": "Toggle Display of Test Coverage Results",
171-
"category": "Swift"
172-
},
173163
{
174164
"command": "swift.attachDebugger",
175165
"title": "Attach to Process...",

0 commit comments

Comments
 (0)