Author Topic: SoapUI: Detecting which endpoint is being used and adapting your test to it  (Read 5824 times)

Offline John Gimber

  • QA Test Manager
  • Administrator
  • Newbie
  • *****
  • Posts: 14
  • Karma: +0/-0
  • QualityScape FTW!
    • View Profile
    • QualityScape
Sometimes when you run SoapUI tests against a variety of different servers, some tests will only be required on specific servers, or will react differently on each server (e.g. datapaths, test data vs real data...)

A quick and dirty way to adapt your groovy assertion script to this is to detect the endpoint (which server is being used) and change the flow of the test in situ.

Here's a sample of code to do this:

Code: [Select]
thisEndPoint = context.getProperty("EndPoint")
log.info "- Project endpoint: $thisEndPoint"
if (thisEndPoint.contains("server1"))
{
    log.info "- This test is running against server 1."
    // Do the test that only works on server 1.
}
else
{
    log.info "- This test is running against server 2."
    // Do the test that only works on server 2.
}
Most people just don't understand QA.  Spread the good word!
QualityScape - Forum
View John Gimber's profile on LinkedIn