I have Solidity code that, given the input of the sender's wallet address, deterministically produces a resulting output.

My goal is to write a unit test for this functionality. Is there a way I can override the msg.sender value?

I'm using Truffle 4.0.4 alongside testrpc.

1 Answer 1


One way to achieve that would be to run testrpc always using the same mnemonic which will always generate the same accounts.

You can do that by doing testrpc -m "word1 word2 word3 word..."

  • Ah, of course! I'll do that. Thanks for the recommendation. Commented Jan 6, 2018 at 1:25

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.