0

I'm trying to check the coverage of an entire ERC20 set of openzeppelin tests. I'm using openzeppelin/test-environment and solidity-coverage v0.7.4 as plugins in truffle. The tests went fine but I get odd results for coverage.

Contract      | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines
Context.sol   | 0       | 100      | 0       | 0       | 20,24,25       |
ERC20.sol     | 0       | 0        | 0       | 0       |... 217,227,228 |
ERC20Mock.sol | 0       | 100      | 0       | 0       |... 16,20,24,28 |
IERC20.sol    | 100     | 100      | 100     | 100     |                |
SafeMath.sol  | 0       | 0        | 0       | 0       |... 136,153,154 |

As you can see, only IERC20 got entirely covered, and ERC20 got nothing despite of this contract being the implementation of the IERC20 itself. SafeMath should have some coverage as well. Does anyone can explain this? This is my first time using solidity-coverage, any help is much appreciated.

0

When solidity-coverage completes, a folder named coverage is created next to the contracts folder (located inside your project folder).

Inside the coverage folder, there is a file named index.html, which you can open in a browser and find the coverage report depicted in a very descriptive format.

  • I have the same information there as the one I posted here! No use on that one as well – honeybadger Apr 26 '20 at 16:43
  • @honeybadger: Yes, but you can click on each one of your files and folders on the left side of the table, and a detailed report for that file or folder will be rendered in your browser. – goodvibration Apr 26 '20 at 16:44
  • @honeybadger: Please acknowledge. – goodvibration Apr 26 '20 at 16:58
  • That is correct, but it shows the red color in each statement/branch for each contract files. All except the IERC20.sol. That is the problem. According to the coverage there are no other files covered but this one – honeybadger Apr 26 '20 at 17:49
  • Please have a look at this repo that has the project being tested – honeybadger Apr 26 '20 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.