TL;DR
- SoapUI tests both REST and SOAP APIs with GUI-based interface
- Create projects → add services (WSDL/REST) → build test suites → add assertions
- Assertions validate response: contains, XPath, JSONPath, status codes
- Data-driven testing reads test data from files (CSV, Excel, database)
- Mock services simulate APIs for testing without real backends
Best for: Enterprise SOAP testing, complex API workflows, teams needing GUI tool Skip if: Only testing simple REST APIs (Postman is easier) Reading time: 14 minutes
Your integration uses SOAP services. The WSDL has 50 operations. You need to test complex request/response patterns with XML namespaces. Postman feels awkward for this.
SoapUI was built for SOAP. It parses WSDLs, generates requests, handles XML namespaces. REST support came later but works well too.
This tutorial covers SoapUI from installation through automation — everything for effective API testing.
What is SoapUI?
SoapUI is an API testing tool focused on web services. It handles both SOAP (with full WSDL support) and REST APIs with a desktop application interface.
Why SoapUI:
- SOAP expertise — parses WSDL, handles namespaces
- REST support — JSON/XML, OAuth, modern APIs
- GUI-based — visual test building
- Mock services — simulate APIs
- Data-driven — parameterized testing
- Assertions — built-in validation options
SoapUI versions:
| Feature | Open Source | ReadyAPI (Pro) |
|---|---|---|
| REST/SOAP testing | ✓ | ✓ |
| Assertions | ✓ | ✓ |
| Mock services | ✓ | ✓ |
| Groovy scripting | ✓ | ✓ |
| Data-driven UI | Limited | Full |
| Reporting | Basic | Advanced |
| Price | Free | Paid |
Installation
Download and Install
- Download from soapui.org
- Choose Open Source or ReadyAPI trial
- Run installer (Windows/macOS/Linux)
- Launch SoapUI
First Project
- File → New SOAP Project or New REST Project
- Enter project name
- For SOAP: enter WSDL URL
- For REST: enter base URL
Testing SOAP Services
Import WSDL
File → New SOAP Project
Project Name: PaymentService
Initial WSDL: https://api.example.com/payment?wsdl
☑ Create Requests
SoapUI automatically:
- Parses all operations
- Creates sample requests
- Sets up namespaces
Execute SOAP Request
<!-- Generated request for ProcessPayment operation -->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:pay="http://example.com/payment">
<soapenv:Header/>
<soapenv:Body>
<pay:ProcessPayment>
<pay:amount>99.99</pay:amount>
<pay:currency>USD</pay:currency>
<pay:cardNumber>4111111111111111</pay:cardNumber>
</pay:ProcessPayment>
</soapenv:Body>
</soapenv:Envelope>
Click green play button to execute.
SOAP Assertions
Right-click request → Add Assertion:
Contains:
Content: <status>SUCCESS</status>
XPath Match:
XPath: //pay:transactionId
Expected: exists
SOAP Fault:
Check: Not SOAP Fault (test passes if no fault)
Testing REST APIs
Create REST Project
File → New REST Project
Project Name: UserAPI
Initial URL: https://api.example.com
Add REST Request
- Right-click project → New REST Service from URI
- Enter:
https://api.example.com/users - Method: GET, POST, PUT, DELETE
REST Request Example
Method: POST
Endpoint: https://api.example.com/users
Headers:
Content-Type: application/json
Authorization: Bearer ${token}
Body:
{
"name": "John Doe",
"email": "john@example.com",
"role": "user"
}
REST Assertions
JSONPath Match:
JSONPath: $.id
Expected: exists
JSONPath Count:
JSONPath: $.items[*]
Expected Count: 10
Valid HTTP Status:
Status Codes: 200,201
Building Test Suites
Test Structure
Project
└── TestSuite: User Management
├── TestCase: Create User
│ ├── REST Request: POST /users
│ └── Assertion: Status 201
├── TestCase: Get User
│ ├── REST Request: GET /users/{id}
│ └── Assertion: JSONPath $.name exists
└── TestCase: Delete User
├── REST Request: DELETE /users/{id}
└── Assertion: Status 204
Create Test Suite
- Right-click project → New TestSuite
- Name: “User Management Tests”
- Right-click TestSuite → New TestCase
- Add test steps (requests, assertions)
Property Transfer
Pass data between test steps:
Source: Create User Response
Property: Response
Path: $.id
Target: Get User Request
Property: userId
Now ${userId} in Get User request uses created ID.
Assertions
Common Assertions
| Assertion | Use Case |
|---|---|
| Contains | Response contains text |
| Not Contains | Response doesn’t contain |
| XPath Match | XML element value |
| JSONPath Match | JSON field value |
| Valid HTTP Status | Status code check |
| Response SLA | Response time limit |
| Script | Custom Groovy validation |
XPath Assertions
<!-- Response -->
<response>
<user>
<id>123</id>
<name>John</name>
</user>
</response>
XPath: //user/name/text()
Expected: John
JSONPath Assertions
{
"user": {
"id": 123,
"name": "John",
"roles": ["admin", "user"]
}
}
JSONPath: $.user.name
Expected: John
JSONPath: $.user.roles[0]
Expected: admin
JSONPath: $.user.roles.length()
Expected: 2
Data-Driven Testing
Using Properties
Project → Custom Properties:
baseUrl = https://api.example.com
apiKey = abc123
Request URL: ${#Project#baseUrl}/users
Header: X-API-Key: ${#Project#apiKey}
DataSource (Groovy)
// In test step: Groovy Script
def testData = [
[name: "John", email: "john@test.com"],
[name: "Jane", email: "jane@test.com"],
[name: "Bob", email: "bob@test.com"]
]
testData.each { data ->
testRunner.testCase.setPropertyValue("userName", data.name)
testRunner.testCase.setPropertyValue("userEmail", data.email)
def step = testRunner.testCase.getTestStepByName("Create User")
step.run(testRunner, context)
}
CSV Data Source (ReadyAPI)
DataSource: CSV
File: users.csv
Columns: name, email, expectedStatus
Loop executes test for each row.
Mock Services
Create Mock
- Right-click SOAP/REST service → Generate Mock Service
- Configure responses for each operation
- Start mock service
Static Mock Response
// Mock response for GET /users/123
{
"id": 123,
"name": "Mock User",
"email": "mock@example.com"
}
Dynamic Mock (Groovy)
// Script in mock response
def requestId = mockRequest.requestContent.id
def response = """
{
"id": ${requestId},
"name": "User ${requestId}",
"timestamp": "${new Date()}"
}
"""
return response
Groovy Scripting
Pre-Request Script
// Generate timestamp for request
import java.text.SimpleDateFormat
def sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
def timestamp = sdf.format(new Date())
testRunner.testCase.setPropertyValue("timestamp", timestamp)
Post-Response Script
// Extract and store value from response
import groovy.json.JsonSlurper
def response = context.expand('${Create User#Response}')
def json = new JsonSlurper().parseText(response)
testRunner.testCase.setPropertyValue("userId", json.id.toString())
log.info "Created user with ID: ${json.id}"
Assertion Script
// Custom validation
import groovy.json.JsonSlurper
def response = messageExchange.response.contentAsString
def json = new JsonSlurper().parseText(response)
assert json.status == "SUCCESS" : "Expected SUCCESS but got ${json.status}"
assert json.items.size() > 0 : "Expected items but got empty array"
Command Line Execution
TestRunner
# Run test suite
testrunner.sh -s "TestSuite Name" project.xml
# Run specific test case
testrunner.sh -s "TestSuite" -c "TestCase" project.xml
# With properties
testrunner.sh -Pbaseurl=https://staging.example.com project.xml
# Output reports
testrunner.sh -r -j -f ./reports project.xml
CI/CD Integration
# Jenkins pipeline
pipeline {
stages {
stage('API Tests') {
steps {
sh '''
/opt/soapui/bin/testrunner.sh \
-s "Regression" \
-r -j \
-f ./reports \
./api-tests.xml
'''
}
post {
always {
junit 'reports/*.xml'
}
}
}
}
}
SoapUI with AI Assistance
AI tools can help with SoapUI testing workflows.
What AI does well:
- Generate test data variations
- Explain SOAP/WSDL structures
- Write Groovy scripts for assertions
- Convert between JSON and XML
What still needs humans:
- Understanding business rules
- Designing test scenarios
- Debugging complex XML namespaces
- Security testing decisions
FAQ
What is SoapUI?
SoapUI is a popular API testing tool for REST and SOAP web services. Originally built for SOAP testing with full WSDL support, it now handles REST APIs too. It provides a GUI for building tests, assertions for validation, mock services for simulation, and Groovy scripting for customization. Available as free Open Source and paid ReadyAPI versions.
Is SoapUI free?
SoapUI Open Source is completely free. It includes REST/SOAP testing, assertions, mock services, and Groovy scripting. ReadyAPI (formerly SoapUI Pro) is paid software with additional features: visual data-driven testing, advanced reporting, team collaboration, and support.
SoapUI vs Postman — which is better?
Postman is simpler, more modern, and better for REST API testing. SoapUI excels at SOAP services, complex XML handling, and enterprise testing scenarios. If you primarily work with SOAP or need advanced mock services, choose SoapUI. For REST-only teams wanting quick setup, Postman is usually better.
Can SoapUI test REST APIs?
Yes. Despite its SOAP-focused name, SoapUI handles REST APIs well. It supports JSON/XML responses, JSONPath assertions, OAuth/bearer authentication, and all HTTP methods. REST testing in SoapUI is straightforward, though Postman may feel more intuitive for REST-only work.
Official Resources
See Also
- API Testing Tutorial - API testing fundamentals
- Postman Tutorial - REST API testing
- REST Assured Tutorial - Java API testing
- API Security Testing - Security testing basics
