4

Is there a way so that I can mock blockchain for unit test in quorum. I do not want to set up a test blockchain for unit testing. Is there any possibility.

  • I don't know if you already tried this truffleframework.com/tutorials/… – cleanunicorn May 24 '18 at 7:38
  • My question is regarding mocking blockchain for unit testing... Above link is imteo about Quorum – Mr_Hmp May 24 '18 at 8:02
  • Best tool for mocking blockchain for unit tests is Ganache. Did you test this? – cleanunicorn May 24 '18 at 10:41
  • Using ganache/truffle to test Quorum is a lot more complicated than normal testing, and is probably why OP doesn't want to use it, see truffleframework.com/tutorials/…. You're best choice is to use the SimulatedBackend package build into Quorum. – hextet May 28 '18 at 23:17
1

Since Quorum is essentially running the EVM on the background, I assume you are using Solidity to code your smart contracts.

The official online Solidity IDE called Remix enables you to simulate the blockchain within the browser via the Javascript VM.

Simply go to the Run tab, select the Javascript VM option and then you can interact with and deploy the contract using the buttons that appear on that tab as showcased below:

Remix IDE Run Tab Image

0

If you are not relying any Quorum specific features of EVM you can easily use Ethereum testrpc chains.

With Populus and Python:

http://populus.readthedocs.io/en/latest/testing.html

With JavaScript:

https://github.com/trufflesuite/ganache-cli

0

The jpmorganchase quorum package has a simulated backend module that can be used to emulate a blockchain for testing purposes without having to run anything.

Keep in mind tools like truffle, and ganache will actually run test blockchain, whereas the simulated backend mock blockchain only persists for the duration of your function calls and all data is gone when the processing is over. Truffle and ganache are quite useful if you want to play around with a more "realistic" blockchain simulation than using the simulated backend module.

https://godoc.org/github.com/jpmorganchase/quorum/accounts/abi/bind/backends

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.