Mock methods of Projekt implementation for Unit tests


(Yves Müller) #1

I am trying to write a unit test for a costume task, which uses ‘project.execute { … }’ to call some external program. I tried now to write a unit test to verify that actually the correct parameters are given to the external program. I tried different approaches like replacing the project with a groovy mock or overwriting the exec and getProject function via MetaClass. None of those yielded success. Are there any other options am I missing something out?

The non working unit test, which executes the programm can be found here