So I have a scripted shared pipeline library in my vars folder that returns some value at the end:
def call() {
def a = 3
//does stuff
return a
}
Now I try to test it like this:
def "example test"() {
when:
def result = scriptUnderTest.call()
then:
result == 3
}
This won't work since result will always be null. I have written quite some tests with Jenkins-Spock for different scenarios already, so the basic mechanisms are clear. But what am I missing in this case?