You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api.md
+24-25Lines changed: 24 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,30 @@
1
-
# Solidity-Coverage API Documentation
1
+
# Solidity-Coverage API
2
2
3
-
`solidity-coverage`'s API provides test coverage measurement for the Solidity language.
4
-
The repository contains two complete coverage tool/plugin implementations (for Buidler and Truffle)
5
-
which can be used as sources if you're building something similar.
3
+
solidity-coverage tracks which lines are hit as your tests run by instrumenting the contracts with special solidity statements and detecting their execution in a coverage-enabled EVM.
6
4
7
-
`solidity-coverage`'s core algorithm resembles the one used by [Istanbul][3] for javascript programs.
8
-
It tracks line and branch locations by 'instrumenting' solidity contracts with special solidity
9
-
statements and detecting their execution in a coverage-enabled EVM. As such, its API spans the
10
-
full set of tasks typically required to run a solidity test suite.
5
+
As such, the API spans the full set of tasks typically required to run a solidity test suite. The
6
+
table below shows how its core methods relate to the stages of a test run:
11
7
12
-
+ compile
13
-
+ ethereum client launch
14
-
+ test
15
-
+ report outcome and exit
8
+
| Test Stage <imgwidth=200/> | API Method <imgwidth=200/> | Description <imgwidth=800/> |
| compilation |`instrument`| A **pre-compilation** step: Rewrites contracts and generates an instrumentation data map. |
11
+
| client launch |`ganache`| A **substitute** step: Launches a ganache client with coverage collection enabled in its VM. As the client,runs it will mark line/branch hits on the instrumentation data map. |
12
+
| test |`report`| A **post-test** step: Generates a coverage report from the data collected by the VM after tests complete. |
13
+
| exit |`finish`| A **substitute** step: Shuts client down |
0 commit comments