Skip to content

Instantly share code, notes, and snippets.

@infomaven
Last active May 28, 2024 00:11
Show Gist options
  • Select an option

  • Save infomaven/1ddb9376df1d5dac9e26c56de0147ed0 to your computer and use it in GitHub Desktop.

Select an option

Save infomaven/1ddb9376df1d5dac9e26c56de0147ed0 to your computer and use it in GitHub Desktop.
SoapUI OSS Cheat Sheets

SoapUI Test Execution Methods

Executable soapUI components

SoapUI GUI can "run" the following objects from their respective editors.

  • Project
  • TestSuite
  • TestCase
  • Request

Details for each are included below (Execution Techniques)

Command Line/Terminal

References - https://www.soapui.org/docs/test-automation/running-functional-tests/

TestRunner

Three Test Runners are available 
- Functional
- Load 
- Security 

TestRunner scripts are available as .SH or .BAT and can be found in the SoapUI installation bin directory. ex.

on Mac OS or linux, this would be /Applications/SoapUI-5.7.2.app/Contents/java/app/bin

loadtestrunner.sh securitytestrunner.sh testrunner.sh

A script is also available to run Mock services mockservicerunner.sh and toolsrunner

Run TestRunner using an outside process or application (for example, a Python script or shell script)

Requires SoapUI to be installed on that machine.

https://community.smartbear.com/discussions/readyapi-questions/soapui-testing-and-automation/212243

SOAPUI_RUNNER=${SOAPUI_HOME}/bin/testrunner.sh
SOAPUI_COMMAND="${SOAPUI_RUNNER} "${SOAPUI_TESTS_DIR}/${TEST_SUITE}" -I -f \"${RELATIVE_REPORT_DIR}\" \
                  -PmyCustomEndpoint=httpEndpointHere \
                  -PsecondParameter=secondValue \
                  ${ANY_OTHER_PREDEFINED_SOAPUI_EXTRA_ARGS}"
  echo "Running: ${SOAPUI_COMMAND}"
  sh -c "${SOAPUI_COMMAND}"

TestRunner runs all tests from a Project using custom Endpoint

// note: If used, the Interface and TestStep Requests will still need to use Property Expansions to run correctly

testrunner.bat -FPDF -e "https://bankground.apimate.eu" c:\projects\my-soapui-project.xml

Run Docker container with SoapUI installed inside

[SoapUI Open Source Dockerhub page] (https://hub.docker.com/r/smartbear/soapuios-testrunner/)

The docker container has its own set of arguments.

One of those arguments is designed to encompass the normal SoapUI command line arguments. For the official Smartbear image, this will be the -e COMMAND_LINE=" " argument

docker run -v="Project Folder":/project -v="Report Folder":/reports -v="Extensions Folder":/ext -e COMMAND_LINE="Test Runner Arguments" -it smartbear/soapuios-testrunner:latest

Another example using a 3rd party docker image

https://ddavison.io/2016/02/04/soapui-containerization.html

docker run --name soapie -d -p 3000:3000 ddavison/soapui

curl -F "[email protected]" \
  -F "suite=Bank1_TestSuite" \
  -F "option=-r" \
  http://localhost:3000
  
  // try this format   
  $ curl --form "project=@/path/to/soapui-project.xml" \
             --form "suite=TestSuite" \
   		             --form "properties=@pathToGlobalPropertiesFile" \
   					            --form "option=-r" \ 
   								          https://soapie.orb.local/  
    

Groovy Script

Editor window

Execution Details

How do we get to the execution commands?

Project

Project > Right-click > Select desired Test Runner runs all TestSuites

  • ensure your os user has read + write permissions on the bin directory

Project => Groovy Groovy script must be inside a TestCase and implemented as a "Groovy TestStep". This can be any TestCase

  • TODO: write a Groovy script. Place in location

Project => Editor TestSuites tab > green arrow

TestSuite

TestSuite => Launcher TestSuite => Groovy TestSuite => Editor

TestCase

TestCase => Launcher TestCase => Groovy TestCase => Editor

Request

Request => Launcher Request => Groovy Request => Editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment