integration cli: minor refactor of the build tests

This PR refactors the integration cli build tests. Please note this is only the start of the refactoring and more needs to be done.

This PR only gets rid of some boilerplate code which was being repeated in more places. More consolidation has to be done in a future PR.