You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to test a JTE library that is using the openshift-client plugin. (I have the dependency in my build.gradle already.)
My (cut down, minimal) template looks like this :
I have another test that sets count to 0 and expects 0 echoes and deletes. They both work as expected.
It has taken a lot of trial and error to get to that. But it feels wrong that I have mocked the entire count() function's result to 1. There must be a "better" way! The script under test could create a different selector later and expect a different result and I have no way of setting it.
NB It is not using the builtin groovy count() & delete() functions, but versions from the openshift-client library.
IF my test is totally wrong, then please throw out whichever bits are wrong and suggest improvements!
The text was updated successfully, but these errors were encountered:
I think it is ok to stub the OpenShiftDSL because it is external dependency and usually we don't like to test other class.
As I experienced the Mock is a little buggy, you can use only one instance in one test.
I don't know the JTEPipelineSpecification so I created an example with original JenkinsSpock.
I used GroovyMock now, but I usually use GroovySpy too.
I'm trying to test a JTE library that is using the openshift-client plugin. (I have the dependency in my build.gradle already.)
My (cut down, minimal) template looks like this :
And one of my tests like this :
I have another test that sets count to 0 and expects 0 echoes and deletes. They both work as expected.
It has taken a lot of trial and error to get to that. But it feels wrong that I have mocked the entire count() function's result to 1. There must be a "better" way! The script under test could create a different selector later and expect a different result and I have no way of setting it.
NB It is not using the builtin groovy count() & delete() functions, but versions from the openshift-client library.
IF my test is totally wrong, then please throw out whichever bits are wrong and suggest improvements!
The text was updated successfully, but these errors were encountered: