0

We are automating the Rest APIs using SoapUI free version.

Here we would like to handle the service URL i.e. As of now we have 3 environment for testing: QA, UAT, Pre-Prod. The difference between the environments is the base URL. The end points will be same.

However few endpoints might get changed also. So we have created the automation scripts and suites in UAT using its base URL and endpoints.

Our questions are: Suppose if I want to run my suite in QA environment then there is a change to the base URL and also a few endpoints.

In this case, how to provide base URL in some centralized place like properties files? So that we can run the suites in all the environments in a robust way.

Can anybody help us on this?

Mika Sundland
  • 18,120
  • 16
  • 38
  • 50

2 Answers2

0

It is trivial to parametrize the endpoint of the resource, and then pass the URL from any caller. The "Centralized Endpoint" is described in the official documentation.

SiKing
  • 10,003
  • 10
  • 39
  • 90
0

You can write a setup script on test suite level to maintain you end point url.

I have done something like this

def testcases = testSuite.getTestCaseList()
def endpoint = context.expand( '${#Project#endpoint}' )
def port = context.expand( '${#Project#port}' )

testcases.each { testcase ->
    def teststeps = testcase.getTestStepsOfType( com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.class ) 

    teststeps.each { teststep ->
        teststep.setPropertyValue('endpoint','https://' + endpoint +'-accountservice.com:'+port+'/accountservices')
    }
}

Where you can define endpoint, port based on your test env in the begining of the test project.

Thanks

Arbind Singh
  • 153
  • 1
  • 2
  • 12