Forum Discussion

vadanas's avatar
vadanas
New Contributor
3 years ago

End point request

Hi,

My question is we need to write the script for Multiple end points change at a time i have wrote like this but unfortunately not able to please check my below code

 

def result = com.eviware.soapui.support.UISupport.prompt("Please select the enviornment", "Environment", ['shr-rbdevkong(Kong QA server*)','shr-rbqakong(Kong QA Server Alert*)','hc-kong-qa(Kong QA Server Old*)'])

 
log.info "selectedurl" +result
 
 
 
def Server =['shr-rbdevkong(Kong QA server*)' ,'shr-rbqakong(Kong QA Server Alert*)' ,'hc-kong-qa(Kong QA Server Old*)']
 
 
/*def Endpoints=[""]
def Authorizationlist=[""]*/
 
if (result.toString().equals(Server[0])) {EndPoints = EndPointList[0]; Authorizationlist = "No Authorization";log.info"0"}
log.info "Endpointsvaluee"  + EndPoints
log.info "Authvalue"  + Authorizationlist
log.info "Server[0]"
 
 
if (result.toString().equals(Server[1])) {EndPoints = EndPointList[1]; Authorizationlist = "No Authorization";log.info"1"}
log.info "Endpointsvalue" +EndPoints
log.info "Authvalue" + Authorizationlist
log.info "Server[1]"
 
 
if (result.toString().equals(Server[2])) {EndPoints = EndPointList[2]; Authorizationlist = "No Authorization";log.info"2"}
 
log.info "Endpointsvalue" +EndPoints
log.info "Authvalue" + Authorizationlist
log.info "Server[2]"
 
 
//for all  testsuites
   

 

    def testSuites = testSuite.project.getTestSuiteList()
    log.info testSuites.size
 
    testSuites.each { testSuite ->
log.info "TestSuite name:::"+testSuite.getName()

 

def testcases = testSuite.getTestCaseList()
log.info testcases.size
log.info "Test Cases under the test suite ::::"+testSuite.getName()
 
testcases.each { testCase ->
log.info "TestCase name:::"+testCase.getName()
log.info "Test Steps under the test Case ::::"+testCase.getName()
 
def teststeps = testCase.getTestStepList()
log.info teststeps.size
teststeps.each { testStep ->
log.info "TestStep name:::"+testStep.getName()
 

def teststeps = testcase.getTestStepList()

teststeps.each { teststep ->

teststep.setPropertyValue('endpoint','EndPoint')

 

if {teststep.config.type =="restrequest"} {

def httpRequest =teststep.getHttpRequest()

 

httpRequest.setPreemptive(true);

httpRequest.setselectdAuthProfileandAuthType(Authorizationlist,com.eviware.soapui.config.CredentialsConfig.AuthType.PREEMPTIVE);

}

}

}

 

 

No RepliesBe the first to reply