TeamCity build runner plugin for executing REST call and analyzing the response.
Features:
- Execute REST call with the given request parameters to the specified endpoint.
- Specify BASIC auth credentials (advanced build runner options) in case if endpoint require BASIC auth.
- Response assertion with
Allowed HTTP codeslist. If response HTTP code not in theAllowed HTTP codeslist then build will fail. If no code specified in theAllowed HTTP codeslist then response can contains any of the exist HTTP codes. - Response assertion with
Allowed HTTP headerslist. All headers should match against the real headers of the response. - Response handling with Groovy script. The given script will contain input parameters:
response- response string,headers- response HTTP headers. Script must return a conditional boolean flag with valuetrue- means no build fail needed orfalsefor fail the build.
Groovy script example:
def parser = new groovy.json.JsonSlurper()
def user = parser.parseText("$response")
user.name == 'Dmitry' && headers['Content-Type'][0] == 'application/json;charset=UTF-8'For those who connected behind corporate HTTP(S) proxy server: HTTP(S) Proxy server should be specified in the following places:
- In server JVM parameters (TEAMCITY_SERVER_OPTS)
- In agent JVM parameters (TEAMCITY_AGENT_OPTS)
E.g. for HTTP proxy server:
-Dhttp.proxyHost=somecompany.com -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts="localhost|192.168.*"
E.g. for HTTPS proxy server:
-Dhttps.proxyHost=somecompany.com -Dhttps.proxyPort=3128 -Dhttps.nonProxyHosts="localhost|192.168.*"