Skip to content

Instantly share code, notes, and snippets.

@ko2ic
Created September 15, 2014 16:49
Show Gist options
  • Save ko2ic/4b82772f2d059a777deb to your computer and use it in GitHub Desktop.
Save ko2ic/4b82772f2d059a777deb to your computer and use it in GitHub Desktop.
Jmeterの結果をChatworkで知らせる方法 ref: http://qiita.com/ko2ic/items/0c22be5ecf31820af2ef
def assertResults = prev.assertionResults;
def response = prev.responseDataAsString
def statusCode = prev.responseCode
def postBody
if(response.contains('ERROR') || assertResults.any{it.isFailure()} || statusCode != '200') {
postBody = ['body':'Error !']
}else {
postBody = ['body':'Success !']
}
def http = new groovyx.net.http.HTTPBuilder( 'https://api.chatwork.com' )
http.post( path: "/v1/rooms/${vars['chatwork.roomId']}/messages",
body: postBody,
headers: ['X-ChatWorkToken' : "${vars['chatwork.token']}"] ) { res ->
assert res.statusLine.statusCode == 200
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment