Using Project Custom Properties to replace all end point of test cases

In SoapUI project, define the Custom Properties "END_POINT"

In SoapUI project "Load Script", add the following groovy scripts

log.info(project.getPropertyValue("END_POINT"))
def Endpoint = project.getPropertyValue("END_POINT")
testSuiteList = project.getTestSuites()
log.info(testSuiteList)
text = "~"
testSuiteList.each
{
	testSuite = project.getTestSuiteByName(it.key)
	testCaseList = testSuite.getTestCases()
	//log.info " ${text*5} TestSuite :: $testSuite.name"
	//log.info("$testSuite.name")
	if ("$testSuite.name".startsWith("TestSuites_")){
		testCaseList.each
		{
			 testCase = testSuite.getTestCaseByName(it.key)
			 //log.info " ${text*5} Testcase :: $testCase.name"
			 wsdlTestSteps = testCase.getTestStepsOfType( com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.class )  //only WsdlTestRequest steps
			 wsdlTestSteps.each
			  {
			  //log.info it.properties['Endpoint'].value
			  it.properties['Endpoint'].value = Endpoint
			  }
		 } 
	log.info "All the endpoints of $testSuite.name are now : $Endpoint"	 	
	}
}
原文地址:https://www.cnblogs.com/z1500592/p/6694570.html