I am writing unit tests for a function where I am sending tokens from one address to other in exchange of ether. I ran these tests a few times and now I am left with 0 ether in one account. I tried searching online but couldn't find a way to reset the balances.

Is there a way to reset the balance back to 100 before and after running those tests. I am using truffle js to write the tests! http://truffleframework.com/docs/getting_started/javascript-tests

  • Are you talking about tests written in Solidity or JavaScript?
    – philippe_b
    Commented Mar 5, 2018 at 14:26

1 Answer 1


I had a similar issue. Never figured out how to reset the balances, but if you use the ganache-cli provider you can configure how much ether your test accounts are given at the start, so you can bump that up from 100. Alternatively you can use that capability to fund an extra account and then transfer eth from the "bank" account in a beforeEach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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