How to change contract runner params programatically for unit testing

Hello all,

basically, the topic says it all. I would like to add a new switch as configuration parameter. It would be ok in either setup or runner parameter sets from the functional point of view.

The only reason I prefer the contract setup parameters is that they can be easily varied during unit testing. Now I am hitting the 160 char limit for the setup params, and wonder if there is a way to also change the contract runner params programatically.

Would it be possible for example to create another *Test.class file for the "switched" parameters, and add loading of different runner params into the ContractRunnerSuite code? That's just an idea, maybe there is a better way.

To deploy the contract on a unit test I assume you are using ContractTestHelper.deployContract() right?

That's an overloaded method. There are some of them that accept a JO as setup parameters.

Yes, correct. I see only the overload for "setupParams", but I would need "runnerParams" as well.

Sorry, I misread you.

The AbstractContractTest class has a setRunnerConfig method.

Check the AccountBalanceNotifierTest as an example of how to change it.

1 Like