Let's say I have a complex operation to execute, for example deploying 6 contracts and calling functions to each one, passing addreses to few of them and executing some extra more functions. I can, of course, call each function manually to pass address and so on, but it takes time and might cause a mistake. So the best way, in theory, would be to have a chunk of code ready to go and executing it once and automatically do the operation.
It would be pretty simple to do it using migration or test, but somebody told me before:
No, this is not a good use of migrations. Migrations are about deploying the system to the network and one-time initialization steps
Adding a builder contract is impossible, because holding few contracts exceeds ethereum limits.
So should I use the Test feature for executing chunks of complex code of my contracts' environment? Even on the mainnet?
chunks of complex code
you mean implement this chunk in Solidity and then invoke it in a single line from a Truffle test, then you've missed the whole point of Truffle, which is to test your contract functionalities - separately (unit-test) and combined (functional-test). Once you implement a whole chunk in Solidity, then you've technically moved themight cause a mistake
part which you're concerned about, from the test to the contract. And believe me, you're much better off with a bug in your test, than a bug in your contract.