Forum Discussion
JJ
17 years agoNew Contributor
Hi Ole,
That's not exactly what I wanted. The examples I mostly see have
one soap request test step and the data varies. I have multiple
soap requests, like a workflow and a value i want to put in all off them
before I execute them.
I want the set 1 single value, a session id, in all the soap requests in
my test case so that they belong to the same session. The session id I
get from the logon response:
holder = groovyUtils.getXmlHolder("Logon#Response");
sessionId = holder.getNodeValue("//ns0:SESSION");
Currently I have to address every test step by name which needs the session
id to be set:
holder2 = groovyUtils.getXmlHolder("GetObservations#Request");
holder2.setNodeValue("//urn:SESSION",sessionId);
holder2.updateProperty();
holder2 = groovyUtils.getXmlHolder("CreateObservation#Request");
holder2.setNodeValue("//urn:SESSION",sessionId);
holder2.updateProperty();
holder2 = groovyUtils.getXmlHolder("GetObservationDetail#Request");
holder2.setNodeValue("//urn:SESSION",sessionId);
holder2.updateProperty();
what i would like is to get rid of the hardcoded references to the test
steps and just do an XPATH to get a list of all the test step, something
like this which would turn all the repetitive copy-paste into a single
loop {pseudo code}:
testStepNames = groovyUtils.getListOfTestStepnames()
for every TestStepName in testStepNames do {
def holder = groovyUtils.getXmlHolder(TestStepName);
holder.setNodeValue("//urn:SESSION",sessionId);
holder.updateProperty();
}
Which makes my groovy script future proff for all the other soap request
test steps i add, relieving me from copy pasting code to support setting
the session in the added test step.
Do you know how to do that?
Thanks,
Jan
That's not exactly what I wanted. The examples I mostly see have
one soap request test step and the data varies. I have multiple
soap requests, like a workflow and a value i want to put in all off them
before I execute them.
I want the set 1 single value, a session id, in all the soap requests in
my test case so that they belong to the same session. The session id I
get from the logon response:
holder = groovyUtils.getXmlHolder("Logon#Response");
sessionId = holder.getNodeValue("//ns0:SESSION");
Currently I have to address every test step by name which needs the session
id to be set:
holder2 = groovyUtils.getXmlHolder("GetObservations#Request");
holder2.setNodeValue("//urn:SESSION",sessionId);
holder2.updateProperty();
holder2 = groovyUtils.getXmlHolder("CreateObservation#Request");
holder2.setNodeValue("//urn:SESSION",sessionId);
holder2.updateProperty();
holder2 = groovyUtils.getXmlHolder("GetObservationDetail#Request");
holder2.setNodeValue("//urn:SESSION",sessionId);
holder2.updateProperty();
what i would like is to get rid of the hardcoded references to the test
steps and just do an XPATH to get a list of all the test step, something
like this which would turn all the repetitive copy-paste into a single
loop {pseudo code}:
testStepNames = groovyUtils.getListOfTestStepnames()
for every TestStepName in testStepNames do {
def holder = groovyUtils.getXmlHolder(TestStepName);
holder.setNodeValue("//urn:SESSION",sessionId);
holder.updateProperty();
}
Which makes my groovy script future proff for all the other soap request
test steps i add, relieving me from copy pasting code to support setting
the session in the added test step.
Do you know how to do that?
Thanks,
Jan