Replace Request In REST TestSteps SoapUI Plugin

Say you have the following scenario:

  1. A SoapUI REST Project defining a Service / Resource / Method / Request
  2. Have generated lots of REST Request TestSteps from it
  3. Then later you need to update the request content in the service definition
  4. And need all related TestSteps to also have their request content updated across all your TestSuites and TestCases  in the project?

Then you could manually update them, maybe write a script or even edit the project definition XML… or you could try this new SoapUI Plugin!

What It Does

  • Adds a new menu item under the REST request menu
  • When clicked this finds all TestSteps that were generated from the REST request
  • Replaces the found TestSteps request content with the content from the REST request
  • Only the request content for matching TestSteps is replaced, no other objects are changed

Usage

Here’s an example:

1. Consider the following small sample REST project:

  • There are 4 requests under resource1, lets pick Request 4.
  • Request 4 has two related REST Test Request TestSteps, both called Method3 – Request 4, one under TestCase 1 and the other under TestCase 2.
  • Then we edit the request content for Request 4.

2.Then to replace the request content in the 2 related TestSteps with the Request 4 request content:

  • Right-click on Request 4
  • Select the new menu item Replace Request In All TestStep(s)

3. Then you should see the the following message:

At this point:

  • The 2 Request 4 related TestSteps should have their request content replaced with Request 4s
  • No other TestSteps should be affected.

4. Alternatively, if you try this on a request with no related TestSteps (like Request 2), then you should see the message:

At this point nothing will be changed.

Installation

  • Please refer to the build and deployment steps on the GitHub project page https://github.com/bearsoftware/ReplaceRequestInAllTestStepsAction
  • The first time you run the build, lots of SoapUI dependencies will be automatically downloaded and tests run, this might take a couple of minutes.
  • I tested the custom action against SoapUI 5.3.0, but it should work on other versions.

Development Approach

The approach I am going to take is:

  • Phase 1 (Done!) : First develop and trial the functionality as a SoapUI custom Action extension – this has allowed me to focus on the getting the core functionality ready for evaluation with the minimum focus on packaging.
  • Phase 2 (Future Option) : Repackage the functionality as a SoapUI Plugin jar as a slightly neater option.
  • Phase 3 (Future Option) : If the functionality seems popular and useful, I could make a pull request integrate the action code directly code into the SoapUI GitHub project as standard functionality.

Notes

In terms of limitations / further thoughts:

  • At this stage this functionality should really be referred to as a SoapUI custom Action, rather than a plugin – I decided to call it a plugin because I may soon provide a way to repackage it as one (Phase 2).
  • Currently only the request content gets replaced, not changes to the the parameters or media type – if this would be useful it could be added?
  • I haven’t done any performance tests e.g. replaced 100 TestSteps, although I can – please let me know if you see any problems.

I’ve linked to this blog article from the SoapUI O/S Feature Request. Please let me know if there are any questions / issues / suggestions that you have either here or on the feature request. Thanks!