Forum Discussion
Slimy37
15 years agoOccasional Contributor
I've progressed a bit since this morning. Here is the Groovy code that I was given to transfer a value back into a test step;
def targetstep = testRunner.testCase.getTestStepByName("Test step");
def targetCase = targetstep.getTestCase();
targetCase.setPropertyValue("propname", "propval");//This is the value you want put into the request.
Within the test step, I have a request as this;
a=2&b=help+me&state=${#TestCase#propname}&return=nothing
From what I understand the '#TestCase#' is how it gets the details from a test case, in my case the test case is called targetCase. It's not actually the name of the test case, which is where I was getting confused before.
However, for some reason this doesn't work all the time, and I don't know why. I sent the XML project over to a friend to look at, he made the changes above and told me what he did. I made the same changes and it didn't work. He then sent the XML project back to me, and it worked fine. I can only assume that something else is involved that he has done without realising.
def targetstep = testRunner.testCase.getTestStepByName("Test step");
def targetCase = targetstep.getTestCase();
targetCase.setPropertyValue("propname", "propval");//This is the value you want put into the request.
Within the test step, I have a request as this;
a=2&b=help+me&state=${#TestCase#propname}&return=nothing
From what I understand the '#TestCase#' is how it gets the details from a test case, in my case the test case is called targetCase. It's not actually the name of the test case, which is where I was getting confused before.
However, for some reason this doesn't work all the time, and I don't know why. I sent the XML project over to a friend to look at, he made the changes above and told me what he did. I made the same changes and it didn't work. He then sent the XML project back to me, and it worked fine. I can only assume that something else is involved that he has done without realising.