-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e858465
commit b7c6259
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Name | ||
==== | ||
|
||
Overview | ||
|
||
## Description | ||
Coverage Tool for SmartContract. | ||
Analayzing based on bytecodes and abi specification for functions. | ||
|
||
## Requirement | ||
Truffle v5.0.14 or higher. | ||
|
||
``` | ||
## Install | ||
`npm install contract-coverage` | ||
## Usage | ||
Add following code in your truffle test cases: | ||
```js | ||
const CoverageSubprovider = require('contract-coverager') | ||
const engine = CoverageSubprovider.injectInTruffle(artifacts, web3) | ||
``` | ||
|
||
and define before, after hook code: | ||
```js | ||
before(() => engine.start()) | ||
after(() => engine.stop()) | ||
``` | ||
|
||
example code overall: | ||
```js | ||
const CoverageSubprovider = require('contract-coverager') | ||
const engine = CoverageSubprovider.injectInTruffle(artifacts, web3) | ||
const VyperStorage = artifacts.require("VyperStorage") | ||
|
||
contract("VyperStorage", (accounts) => { | ||
before(() => engine.start()) | ||
after(() => engine.stop()) | ||
|
||
it("...should store the value 89.", async () => { | ||
const storage = await VyperStorage.new() | ||
|
||
// Set value of 89 | ||
const receipt = await storage.set(89) | ||
// Get stored value | ||
const storedData = await storage.get() | ||
assert.equal(storedData, 89, "The value 89 was not stored.") | ||
}) | ||
}) | ||
``` | ||
|
||
## Demo | ||
![](https://user-images.githubusercontent.com/1563840/57188087-e22b1400-6f33-11e9-8892-475a0454f056.png") | ||
|
||
## Licence | ||
[GPLv3](https://github.com/nakajo2011/contract-coverage/blob/master/LICENCE) | ||
|
||
## Author | ||
[nakajo2011](https://github.com/nakajo2011) |