Testing: Assert on dev revert strings (ape test)
See original GitHub issueOverview
be able to assert using ape.reverts
on the dev revert message (it’s like a special comment in the contract source file).
this feature requires #347 transaction tracing in order to see what line of code the failure occurred on. could also just show the failed line of code directly with the assert, but the dev revert string is useful for coverage testing
Specification
with ape.reverts(dev_message="This is a dev message"):
...
The dev_message
should be a mutually exclusive parameter from the existing expected_message
.
Dependencies
#347
Look at how brownie
did it as an example!
https://eth-brownie.readthedocs.io/en/stable/api-test.html#brownie.test.plugin.RevertContextManager
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Testing — ape documentation - ApeWorX
Testing Transaction Failures. Similar to pytest. raises() , you can use ape. reverts() to assert that contract transactions fail and revert.
Read more >How to write test classes with assert for this method public ...
How to write test classes with assert for this method public static void myFirstMethod() { List<String>listOfStrings = new List<String>{'Anjana' ...
Read more >Asserting reverts when testing Solidity smart contracts with ...
To test this, we will verify that the contract reverts when we don't send any ether or when we send more than the...
Read more >Basics of Javascript Test Driven Development (TDD) with Jest
The grid of test results below shows how each type of message can be unit tested. Message Type, Query, Command. Incoming, Assert result....
Read more >How to test Go function containing log.Fatal() - Stack Overflow
How would I go about testing that the correct messages have been logged? As log.Fatal calls os.Exit(1) the tests fail. package main import...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Completed via https://github.com/ApeWorX/ape/pull/1125
Status update: once https://github.com/ApeWorX/ape/issues/937 is completed this will be able to be finished as well