I have two test cases that are basically doing the same thing, just with slightly different input. After looking at the code for them both, I found that they are both expressible as functions of one variable: a callback (aka a Closure in the Groovy world).
It therefore makes sense to create a parameterized test case that accepts that
Closure<Double> as a parameter, and then have the original two call that parameterized test case with the appropriate Closure.
For both test cases, I use method pointers:
The methods that are being pointed to, are both
static methods that return a plain-ol
When I try to create this parameterized test case, and create the test case variable, the Variables tab doesn’t seem to know what to do with it…
When I go to Variables (Script mode) this is how I have it:
<?xml version="1.0" encoding="UTF-8"?> <Entity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="variableEntityWrapper"> <description></description> <tag></tag> <variables> <defaultValue>com.signaturemd.utils.SMDNumberUtils.&NextWholeDollarAmount</defaultValue> <description></description> <id>a80da491-cd87-4c67-b9f9-04436dc441cf</id> <masked>false</masked> <name>onGenerateAmount</name> </variables> </Entity>
For some reason, this is how it’s coming up in Variables tab (manual mode):
Notice the lack of type. It’s not even showing up as a property!
I can’t even double click to edit!
Yes, it not only works, but it reads in the default type correctly (I run it, and it is producing the amounts as random whole dollar amounts, as expected)
Not sure if I can, or should, do anything about this…