Refactor and reorganize integration tests in hedera-mirror-web3
module
#8057
Labels
enhancement
Type: New feature
epic
Type: Large user story that encompasses multiple tasks
technical debt
test
Test infrastructure, automated tests required, etc
web3
Area: Web3 API
Milestone
Problem
Currently all integrations tests in
hedera-mirorr-web3
rely on a DB test setup, which is processed inContractCallTestSetup
, which creates a strong dependency between all test data. As a result if we change the ID of a single entity, for example, we might break an existing set of tests or see unexpected results. In addition maintenance and adding new tests with new test data would become harder and harder in the future.Solution
Remove
ContractCallTestSetup
as a central database setup and refactor all integration tests to include their own test data and be self-sufficient without relying on an external setup. Each test should create their own entities and needed data, that would be discarded after the test execution.Some extraction of ContractCallTestSetup logic into the separate integration tests, might be an option, but probably the best approach would be adding new DB test data for each separate test from scratch. Avoid extracting common entities and methods in a parent class, as eventually we would construct the same problem of a common big and complex class with DB setup.
We should rely on the existing DomainBuilder as much as possible and avoid hardcoding fields of the built entity if possible. We should use dynamic data and validate the test against it.
Also, research about web3j-solidity-gradle-plugin and web3j-gradle-plugin plugins and investigate if we can make a use of them in the refactor of web3 module integration tests
Alternatives
No response
Tasks
web3j-solidity-gradle-plugin
#8466web3j-gradle-plugin
#8467ContractCallDynamicCallsTest
#8449ContractCallEvmCodesTest
#8450ContractCallNativePrecompileTest
#8380ContractCallNestedCallsTest
#8455ContractCallServiceERCTokenTest
#8456ContractCallServicePrecompileTest
#8451ContractCallServiceTest
#8452ContractCallSystemPrecompileTest
#8453SelfDestructOperationTest
#8379ContractCallAddressThisTest
#8942ContractDebugServiceTest
#8944OpcodeServiceTest
#8945ContractCallNestedCallsHistoricalTest
#8956ContractCallEvmCodesHistoricalTest
#9071ContractCallServicePrecompileHistoricalTest
#9072ContractCallServiceERCTokenHistoricalTest
#9073TestWeb3jService
to not actually deploy the contracts wherever possible #9109ContracCallServiceERCTokenTest
delegate scenario #9162ContractCallServiceERCTokenTest
historical tests #9168ContractCallServiceERCTokenTest
negative tests #9108web3j-cli
and use only theweb3j-gradle-plugin
#9271The text was updated successfully, but these errors were encountered: