Some tips about SoapUI project

1. Test Project and Test Suite name cannot contain blank space.html

    This will cause many TestSuites error if the project was built on Jenkins.api

2. Post body in HTTP request cannot contain charactor '&' .ui

    If it contains '&', the HTTP response will return error information :spa

3. Post body in HTTP request cannot contain charactor '%' .orm

    If it contains '%', the HTTP response will return error information :htm

4. Get active environment via groovy script :ip

    log.info testRunner.testCase.testSuite.project.getActiveEnvironment().getName()get

5. Set active environment via groovy script :it

    testRunner.testCase.testSuite.project.setActiveEnvironment("Live")io

6. Get current project's workspace path: ${projectDir} .

    The property has been invoked.

7. Get one TestStep's response:

  •   def response = testRunner.testCase.testSteps["InitCase"].testRequest.response.contentAsString
  •   def response = context.expand('${InitCase#Response}')
  •   def response = messageExchange.getResponseContent()

8.  Set TestStep's request headers:

     def headerMap = new StringToStringMap()

     headerMap.put("X-API-UserId",'${#Project#X-API-UserId}')
     headerMap.put("Accept-Encoding", "deflate")

     testRunner.testCase.testSteps["InitCase"].testRequest.setRequestHeaders(headerMap)

9.   Set property value into TestSuite:

      testRunner.testCase.testSuite.setPropertyValue(propertyName, propertyValue)

     That's the same logic for setting property value into TestStep and Project.

10.  Get TestStep list of one TestRequest type:

 testRunner.testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.class)

Test Step Type有一下幾種:

HttpTestRequestStep

JdbcRequestTestStep

ManualTestStep

RestTestRequestStep

WsdlDelayTestStep

WsdlGotoTestStep

WsdlGroovyScriptTestStep

WsdlMockResponseTestStep

WsdlPropertiesTestStep

WsdlRunTestCaseTestStep

WsdlTestRequestStep

WsdlTestStep

 11.  Goto one TestStep by Name : 

        testRunner.gotoStepByName("TestStepName")

相關文章
相關標籤/搜索