{"repo":"LFDT-web3j/web3j-unit","free":true,"listed":false,"github":"https://github.com/LFDT-web3j/web3j-unit","clone":"git clone https://github.com/LFDT-web3j/web3j-unit.git","description":"Smart contract testing framework via integrated EVM and various Ethereum clients","language":"Kotlin","stars":29,"topics":["blockchain","testing","web3j","ethereum","geth","parity","docker"],"license":"Apache-2.0","category":"blockchain-web3","readme_excerpt":"Web3j-unit Web3j-unit is a Junit 5 extension to streamline the creation of Ethereum contract tests. Multiple Ethereum implementations are supported including Geth and Besu. To run tests built using Web3j-unit, docker is required on the host. Instances of Web3j , TransactionManager and GasProvider are injected into the Junit runner. You can find a sample here. You can find an example using docker-compose here. This spins up VMWare Concord nodes using a docker-compose file. Getting Started 1. Add dependency to gradle. 2. Create a new test with the @EVMTest annotation. An embedded EVM is used by default. To use Geth or Besu pass the node type into the annotation: @EVMTest(NodeType.GETH) or @EVMTest(NodeType.BESU) 3. Inject instance of Web3j TransactionManager and ContractGasProvider in your test method. 4. Deploy your contract in the test. 5. Run the test! Using a custom docker-compose file 1. Add dependency to gradle. 2. Create a new test with the @EVMComposeTest annotation. By default, uses test.yml file in the project home, and runs web3j on service name node1 exposing the port 8545 . Can be customised to use specific docker-compose file, service name and port by @EVMComposeTest(\"src/test/resources/geth.yml\", \"ethnode1\", 8080) Here, we connect to the service named ethnode1 in the src/test/resources/geth.yml docker-compose file which exposes the port 8080 for web3j to connect to. 3. Inject instance of Web3j TransactionManager and ContractGasProvider in your test method. 4. Dep","default_branch":null,"files":null,"tree":[],"storefront":"/r/LFDT-web3j","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/LFDT-web3j/web3j-unit/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}