3

When I update a resource's path, or add query/matrix parameters to a resource, these changes get "pushed" down into the test steps that rely on (i.e. are associated with) that resource. I'm wondering if the same functionality is available for payloads (request bodies) and request headers?

For example, given a REST project consisting of a resource that supports a PUT request with payload, and a test case for that resource request, is there a way to update the resource request's payload and/or headers, and have that (change) reflected in the test case's test step?

Put differently: How can I push updates from a REST resource definition to associated test steps (when they concern the request body or request headers)?

Push updates from resource definition to associated test steps

(This is a cross-post from the SoapUI forums.)

2
  • Is this post same as sqa.stackexchange.com/questions/16368/…
    – Rao
    Commented Jan 5, 2016 at 18:28
  • Rao, it's related. The other one is to organise tests, while this one is about how to update a test's payload/headers from it's associated request/how to push changes to the request into the test.
    – Christian
    Commented Jan 5, 2016 at 22:47

1 Answer 1

1

I would accomplish this with a groovy script, effectivly you would get the request from your project then use that to update your test step

You can do it with something along the lines ofthe psudo code below;

//Get the value of the project's request 
   def prj = testRunner.testCase.testSuite.project.workspace.getProjectByName("Project 1").getProperty(“Request 1”).getValue()



//get the test case's request  
      tCase =  testRunner.testCase.testSteps["testSteps"].getProperty(“Request 1”).getValue()

tcase = prj 

//set the new request to be that of the project
    tcase.getHttpRequest().setRequestHeaders(headers)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.