Best Practices

Tips for maintainable SoapUI test suites.

Best practices checklist

text
✅ Use Project/Suite/Case properties for config values (base URL, tokens)
✅ Use environments to switch between dev/staging/prod
✅ Write assertions on every request step — don't rely on no-error
✅ Use JSONPath/XPath assertions over "contains" for precision
✅ Extract tokens from login steps using Groovy and reuse them
✅ Use DataSource for data-driven tests — don't copy-paste steps
✅ Name your test steps clearly: "POST Create User", "GET Verify User"
✅ Run from CLI with testrunner.bat for CI integration
✅ Export project as soapui-project.xml and commit to version control
✅ Use Mock Services to stub downstream dependencies

CLI runner (for CI)

bash
# Windows
testrunner.bat -s "MyTestSuite" -c "MyTestCase" -r -j my-project.xml

# Linux/Mac
./testrunner.sh -s "MyTestSuite" -e "Staging" -r -j my-project.xml

# Flags:
# -s = Test Suite name
# -c = Test Case name
# -e = Environment name
# -r = print report
# -j = JUnit-style XML report output