Scripting in a GraphQL-Request
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Scripting in a GraphQL-Request
Hello!
I'm bloody new to SoapUI-Scripting and want to figure out, how to use JavaScript inside of a request.
What I have is a result with a line like this:
{ data: "id::{number:\"123\"} }
I can move the property forward (in this example to a teststep "propertyTeststep" as vaiable "id" - see next codesnipped) but I loose the escape-\
I need this line on a new request as a query variable. My idea is to do something like this:
"id": "${=escape(propertyTeststep.id))}",
My question is, how to do this? How to access the properties of a teststep?
Thank you!
- Labels:
-
Scripting
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey!
I figured out how to access the model.
But first the question, if I don't move the data (so with Property Transfer) I can already do something about it, that SoapUI removes the backslashes. In the response they are still, in the properties after the transfer they are not. Maybe this would be the easiest way...
I now access the property with the name "id" as follows:
${=testCase.testSteps.get('propertyTeststep').id}
But the result in http log is:
[...] \"id\": org.mozilla.javascript.NativeJavaObject@403b554b [...]
But "id" should be the name of the property and the return the string id::number:"123" like a ${propertyTeststep#id} it does. Or I'm wrong?
