Closed ioboi closed 2 years ago
Tests seem more object oriented -> good I miss the test method structure "given, when, then". Could be done with comments.
What are the benefits for changing the test framework? Are all tests easy to migrate?
Hi @chrira
The only benefit I see at the moment is, that we migrate to another Unit-Test-Framework (JUnit) but this is also just a matter of taste I guess :smile:
As most tests at the moment only happen to check the call stack, we would have to write a lot of code.
For example before:
1 * getPipelineMock("error").call('missing parameter: hallo')
this becomes:
assertThat(helper.callStack.stream()
.filter({ it.methodName == "error" })
.flatMap({ Arrays.stream(it.args) })
.any({ it == "missing parameter: hallo" })).isTrue()
with AssertJ or with just JUnit:
assertTrue helper.callStack.stream()
.filter({ it.methodName == "error" })
.flatMap({ Arrays.stream(it.args) })
.any({ it == "missing parameter: hallo" })
As I understand Jenkins Pipeline Unit really shines when used to test pipelines using the shared library.
This pull request is a demonstration if we decide to move from Spock to JenkinsPipelineUnit.
Note: Only migrated tests work at the moment.
This pull request is intended as a discussion basis.