Created
September 15, 2014 16:49
-
-
Save ko2ic/4b82772f2d059a777deb to your computer and use it in GitHub Desktop.
Jmeterの結果をChatworkで知らせる方法 ref: http://qiita.com/ko2ic/items/0c22be5ecf31820af2ef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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