{"id":12037,"date":"2014-12-10T00:00:45","date_gmt":"2014-12-09T15:00:45","guid":{"rendered":"http:\/\/labs.gree.jp\/blog\/?p=12037"},"modified":"2014-12-09T10:16:23","modified_gmt":"2014-12-09T01:16:23","slug":"jmeter%e3%81%a8junit%e3%81%a7%e7%8b%ac%e8%87%aa%e3%83%97%e3%83%ad%e3%83%88%e3%82%b3%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e3%82%92%e5%90%8c%e6%99%82%e6%8e%a5%e7%b6%9a%e6%95%b030000%e3%81%a7","status":"publish","type":"post","link":"https:\/\/labs.gree.jp\/blog\/2014\/12\/12037\/","title":{"rendered":"JMeter\u3068JUnit\u3068Maven\u3067\u72ec\u81ea\u30d7\u30ed\u30c8\u30b3\u30eb\u30b5\u30fc\u30d0\u30fc\u306e\u8ca0\u8377\u30c6\u30b9\u30c8\u3092\u81ea\u52d5\u5316\u3059\u308b\u305e"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u30a4\u30f3\u30d5\u30e9\u30b9\u30c8\u30e9\u30af\u30c1\u30e3\u672c\u90e8\u306e<a href=\"http:\/\/twitter.com\/nagaseyasuhito\" target=\"_blank\">@nagaseyasuhito<\/a>\u3067\u3059\u3002\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u306f GREE Advent Calendar 2014 10\u65e5\u76ee\u306e\u8a18\u4e8b\u3067\u3059\u3002\u6628\u65e5\u306f\u30a4\u30b1\u30e1\u30f3morita\u3055\u3093\u306b\u3088\u308b<a href=\"http:\/\/labs.gree.jp\/blog\/2014\/12\/12548\/\" target=\"_blank\">\u7537\u6027\u30a8\u30f3\u30b8\u30cb\u30a2\u30ea\u30f3\u30b0\u30de\u30cd\u30fc\u30b8\u30e3\u304c\u9577\u671f\u80b2\u4f11\u3092\u53d6\u3063\u305f\u8a71<\/a>\u3067\u3057\u305f\u3002<\/p>\n<p>\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u306f2\u5e74\u304f\u3089\u3044\u524d\u304b\u3089\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u304c\u521d\u30a8\u30f3\u30c8\u30ea\u306b\u306a\u308a\u307e\u3059\u3002\u30b0\u30ea\u30fc\u3067\u306f\u6bd4\u8f03\u7684\u73cd\u3057\u3044JavaEE\u3092\u59cb\u3081\u3068\u3057\u305f\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9Java\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u958b\u767a\u3001Solr\u3084Hadoop\u3068\u3044\u3063\u305f\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306e\u5468\u8fba\u6a5f\u80fd\u958b\u767a\u3084\u904b\u7528\u306a\u3069\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\u3069\u3046\u305e\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u8fd1\u306fPvE\/PvP\/GvG\u306a\u3069\u30e6\u30fc\u30b6\u30fc\u540c\u58eb\u304c\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u5354\u8abf\u30d7\u30ec\u30a4\u3059\u308b\u969b\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8-\u30b5\u30fc\u30d0\u30fc\u9593\u3092\u5e38\u6642\u63a5\u7d9a\u901a\u4fe1\u3067\u884c\u3046\u30b2\u30fc\u30e0\u304c\u5897\u52a0\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306a\u5834\u5408\u306fHTTP\u306eREST API\u306a\u3069\u6163\u308c\u89aa\u3057\u3093\u3060\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u306f\u8981\u4ef6\u3092\u6e80\u305f\u3057\u304d\u308c\u306a\u3044\u305f\u3081\u3001WebSocket\u3084Netty\u3092\u30d9\u30fc\u30b9\u306bThrift\u3084ProtocolBuffer\u306a\u3069\u3092\u4f7f\u3063\u305f\u72ec\u81ea\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u901a\u4fe1\u3092\u3059\u308b\u3053\u3068\u304c\u591a\u304f\u306a\u3063\u3066\u304d\u305f\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>HTTP\u30d9\u30fc\u30b9\u306e\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3042\u308c\u3070Web\u30d6\u30e9\u30a6\u30b6\u3084curl\u306a\u3069\u306e\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u304b\u3089\u3067\u3082\u52d5\u4f5c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3057\u30c6\u30b9\u30c8\u30c4\u30fc\u30eb\u3082\u5145\u5b9f\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u72ec\u81ea\u30d7\u30ed\u30c8\u30b3\u30eb\u3068\u306a\u308b\u3068\u4e00\u822c\u7684\u306a\u30c4\u30fc\u30eb\u3082\u4f7f\u3048\u306a\u3044\u305f\u3081\u3001\u3069\u3046\u3057\u3066\u3082\u30c6\u30b9\u30c8\u304c\u624b\u8584\u306b\u306a\u308a\u304c\u3061\u3067\u3059\u3002<\/p>\n<p>\u3057\u304b\u3082\u591a\u4eba\u6570\u3067\u540c\u6642\u63a5\u7d9a\u901a\u4fe1\u3092\u884c\u3046\u5834\u5408\u3001\u30b5\u30fc\u30d0\u30fc\u5074\u3067\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u9593\u306e\u5354\u8abf\u52d5\u4f5c\u3092\u3055\u305b\u308b\u5834\u5408\u304c\u591a\u3044\u305f\u3081\u3001\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u30a2\u30af\u30bb\u30b9\u304c\u539f\u56e0\u306e\u30d0\u30b0\u3084\u3001\u8ca0\u8377\u304c\u4e0a\u304c\u3063\u305f\u5834\u5408\u306b\u306e\u307f\u73fe\u308c\u308b\u30c7\u30fc\u30bf\u306e\u4e0d\u6574\u5408\u3001\u52b9\u7387\u306e\u60aa\u3044\u540c\u671f\u5316\u306b\u3088\u3063\u3066\u540c\u6642\u63a5\u7d9a\u6570\u304c\u4f38\u3073\u306a\u3044\u306a\u3069\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u9762\u306b\u3082\u6ce8\u610f\u3092\u6255\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u305f\u3081\u3001\u8ca0\u8377\u30c6\u30b9\u30c8\u306f\u5fc5\u9808\u3068\u8a00\u3048\u307e\u3059\u3002<\/p>\n<p><strong>\u305d\u3053\u3067\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u3067\u306f\u72ec\u81ea\u30d7\u30ed\u30c8\u30b3\u30eb\u30b5\u30fc\u30d0\u30fc\u306b\u5bfe\u3059\u308b\u8ca0\u8377\u30c6\u30b9\u30c8\u3092\u3001JMeter\u3068JUnit\u3092\u4f7f\u3044Maven\u304b\u3089\u8907\u6570\u306e\u30b5\u30fc\u30d0\u30fc\u3067\u5206\u6563\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066CI\u306b\u4e57\u305b\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/strong><\/p>\n<p>\u4eca\u56de\u306e\u30b5\u30f3\u30d7\u30eb\u306f<a href=\"http:\/\/github.com\/nagaseyasuhito\/sample-jmeter\" target=\"_blank\">\u3053\u3061\u3089\u306eGitHub\u306e\u30ea\u30dd\u30b8\u30c8\u30ea<\/a>\u3067\u516c\u958b\u3057\u3066\u3044\u308b\u306e\u3067\u305c\u3072\u3054\u81ea\u8eab\u306e\u7aef\u672b\u3067\u5b9f\u884c\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u8ca0\u8377\u30c6\u30b9\u30c8\u304c\u3088\u308a\u8eab\u8fd1\u306b\u611f\u3058\u3089\u308c\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u72ec\u81ea\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u8ca0\u8377\u8a66\u9a13<\/h2>\n<p>\u8ca0\u8377\u30c6\u30b9\u30c8\u30c4\u30fc\u30eb\u3068\u8a00\u3048\u3070JMeter\u3084Gatling\u3001Grinder\u3042\u305f\u308a\u304c\u6709\u540d\u3067\u3059\u304c\u4eca\u56de\u306fJMeter\u3092\u4f7f\u3044\u307e\u3059\u3002JMeter\u3067\u72ec\u81ea\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30c6\u30b9\u30c8\u3068\u8a00\u3046\u3068\u300c\u65b0\u898f\u306b\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f5c\u308b\u306e\u304b\u306a\u300d\u3068\u601d\u308f\u308c\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u9055\u3044\u307e\u3059\u3002JMeter\u306b\u306f<strong>JUnitSampler<\/strong>\u3068\u3044\u3046\u305d\u306e\u540d\u306e\u901a\u308a<strong>JUnit\u3067\u66f8\u304b\u308c\u305f\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u30b5\u30f3\u30d7\u30e9\u30fc<\/strong>\u304c\u6a19\u6e96\u3067\u5b58\u5728\u3059\u308b\u306e\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u6163\u308c\u89aa\u3057\u3093\u3060JUnit\u3067<strong>\u7d50\u5408\u30c6\u30b9\u30c8\u3092\u66f8\u304f\u3088\u3046\u306b\u8ca0\u8377\u30c6\u30b9\u30c8\u306e\u30b7\u30ca\u30ea\u30aa\u3092\u8a18\u8ff0<\/strong>\u3057\u3001\u305d\u308c\u3092JMeter\u3092\u4f7f\u3063\u3066\u5b9f\u884c\u3059\u308b\u3068\u3044\u3046<strong>\u3044\u3064\u3082\u901a\u308a\u306e\u958b\u767a\u306b\u5c11\u3057\u3060\u3051\u624b\u9593\u3092\u304b\u3051\u308b\u3060\u3051\u3067\u7c21\u5358\u306b\u8907\u6570\u53f0\u306e\u30b5\u30fc\u30d0\u30fc\u3092\u4f7f\u3063\u305f\u8ca0\u8377\u30c6\u30b9\u30c8\u3092\u5b9f\u884c<\/strong>\u3067\u304d\u308b\u306e\u3067\u3059\u3002<\/p>\n<h2>Echo\u30b5\u30fc\u30d0\u30fc\u3068\u30af\u30e9\u30a4\u30a2\u30f3\u30c8<\/h2>\n<p>\u4eca\u56de\u306fWebSocket\u3092\u4f7f\u3063\u305fEcho\u30b5\u30fc\u30d0\u30fc\u3092\u984c\u6750\u306b\u53d6\u308a\u4e0a\u3052\u307e\u3059\u3002JavaEE\u306e\u8a71\u306b\u306a\u308b\u306e\u3067JMeter\u306e\u8a71\u3092\u65e9\u304f\u8aad\u307f\u305f\u3044\u65b9\u306f\u3053\u306e\u7ae0\u306f\u98db\u3070\u3057\u3066\u3082\u3089\u3063\u3066\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>Java\u306b\u306fJSR356\u3068\u3044\u3046WebSocket\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4ed5\u69d8\u304c\u3042\u308b\u306e\u3067\u3001\u305d\u308c\u306b\u5247\u3063\u3066\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30b5\u30fc\u30d0\u30fc\u5b9f\u88c5<\/h3>\n<p>@ServerEndpoint\u3067\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3001@OnMessage\u306e\u4ed8\u52a0\u3055\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u3067\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u9001\u4fe1\u3055\u308c\u305f\u6587\u5b57\u5217\u3092\u30ed\u30b0\u306b\u51fa\u529b\u3057\u305f\u5f8c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u9001\u308a\u8fd4\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:java decode:true\" title=\"EchoServer\">@Slf4j\n@ServerEndpoint(\"\/echo\")\npublic class EchoServer {\n    @OnMessage\n    public String onMessage(String message) {\n        log.info(\"Message Received: \" + message);\n        return message;\n    }\n}<\/pre>\n<h3>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5b9f\u88c5<\/h3>\n<p>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3082\u30b5\u30fc\u30d0\u30fc\u3068\u540c\u3058\u3088\u3046\u306b\u8a18\u8ff0\u3067\u304d\u307e\u3059\u3002@OnOpen\u306f\u30b5\u30fc\u30d0\u30fc\u3068\u63a5\u7d9a\u304c\u78ba\u7acb\u3057\u305f\u969b\u306b\u547c\u3070\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u306b\u4ed8\u52a0\u3059\u308b\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u3002NUMBER_OF_LOOPS\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u56de\u6570\u3060\u3051\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d7\u4fe1\u3057\u305f\u3089\u63a5\u7d9a\u3092\u9589\u3058\u307e\u3059\u3002CountDownLatch\u306f\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u74b0\u5883\u4e0b\u3067\u5b89\u5168\u306b\u30b9\u30ec\u30c3\u30c9\u7d42\u4e86\u3092\u5f85\u6a5f\u3055\u305b\u308b\u305f\u3081\u306e\u540c\u671f\u5316\u652f\u63f4\u6a5f\u80fd\u3067\u3059\u3002CountDownLatch.countDown()\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3057\u3001\u5225\u30b9\u30ec\u30c3\u30c9\u306b\u63a5\u7d9a\u304c\u9589\u3058\u305f\u3053\u3068\u3092\u4f1d\u3048\u307e\u3059\u3002<\/p>\n<pre class=\"lang:java decode:true\" title=\"EchoClient.java\">@Getter\n@ClientEndpoint\npublic class EchoClient {\n    public static final int NUMBER_OF_LOOPS = 10;\n    private List receivedMessages = new ArrayList&lt;&gt;();\n    private CountDownLatch latch = new CountDownLatch(1);\n\n    @OnOpen\n    public void onOpen(Session session) throws IOException {\n        session.getBasicRemote().sendText(UUID.randomUUID().toString());\n    }\n\n    @OnMessage\n    public void onMessage(Session session, String message) throws IOException {\n        this.receivedMessages.add(message);\n\n        if (this.receivedMessages.size() == NUMBER_OF_LOOPS) {\n            session.close();\n            this.latch.countDown();\n        } else {\n            session.getBasicRemote().sendText(UUID.randomUUID().toString());\n        }\n    }\n}<\/pre>\n<h3>\u7d50\u5408\u30c6\u30b9\u30c8<\/h3>\n<p>\u305d\u308c\u3067\u306f\u3053\u306e\u30b5\u30fc\u30d0\u30fc\u3068\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u7d50\u5408\u30c6\u30b9\u30c8\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u306e\u7d50\u5408\u30c6\u30b9\u30c8\u306fArquillian\u3092\u4f7f\u3044\u307e\u3059\u3002Arquillian\u306fJUnit\u3067\u66f8\u3044\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c6\u30b9\u30c8\u3092Tomcat\u3084Jetty\u304b\u3089GlassFish\u3001Wildfly\u307e\u3067\u69d8\u3005\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3057\u3001\u305d\u306e\u4e0a\u3067\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3066\u304f\u308c\u308b\u30b9\u30b0\u30ec\u30e2\u30ce\u3067\u3059\u3002<\/p>\n<p>Arquillian\u306f\u30c6\u30b9\u30c8\u306e\u969b\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30d1\u30b9\u306bUUID\u3092\u4f7f\u3046\u305f\u3081\u5b9f\u884c\u3059\u308b\u5ea6\u306bURL\u304c\u7570\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u305d\u3053\u3067@RunAsClient\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068@ArquillianResource\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u304c\u4ed8\u4e0e\u3055\u308c\u305fjava.net.URL\u578b\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u30c7\u30d7\u30ed\u30a4\u5148\u306eURL\u304c\u30a4\u30f3\u30b8\u30a7\u30af\u30c8\u3055\u308c\u307e\u3059\u3002\u7d50\u5408\u30c6\u30b9\u30c8\u3067\u306f\u3053\u306eURL\u304b\u3089WebSocket\u3067\u63a5\u7d9a\u3059\u308bURI\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u5148\u307b\u3069EchoClient\u306b\u5b9a\u7fa9\u3057\u305fCountDownLatch\u306eawait()\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076\u3053\u3068\u3067\u3001\u5185\u90e8\u7684\u306b\u4fdd\u6301\u3057\u3066\u3044\u308b\u30ab\u30a6\u30f3\u30bf\u304c0\u306b\u306a\u308b\u307e\u3067\u51e6\u7406\u3092\u30d6\u30ed\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:java decode:true \" title=\"EchoEndpointIT.java\">@RunWith(Arquillian.class)\n@RunAsClient\npublic class EchoEndpointIT {\n    @ArquillianResource\n    protected URL url;\n\n    @Deployment\n    public static Archive&lt;?&gt; createDeployment() {\n        return ShrinkWrap.create(WebArchive.class).addClass(EchoServer.class);\n    }\n\n    @Test\n    @SneakyThrows\n    public void echoSuccess() {\n        URI uri = new URI(this.url.toString().replaceAll(\"http:\/\/\", \"ws:\/\/\") + \"\/echo\").normalize();\n\n        WebSocketContainer container = ContainerProvider.getWebSocketContainer();\n        EchoClient client = new EchoClient();\n        container.connectToServer(client, uri);\n        client.getLatch().await();\n\n        assertThat(client.getReceivedMessages().size(), is(EchoClient.NUMBER_OF_LOOPS));\n    }\n}\n<\/pre>\n<p>\u3053\u306e\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u306b\u306fpom.xml\u306bmaven-failsafe-plugin\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;plugin&gt;\n    &lt;artifactId&gt;maven-failsafe-plugin&lt;\/artifactId&gt;\n    &lt;version&gt;2.18&lt;\/version&gt;\n    &lt;executions&gt;\n        &lt;execution&gt;\n            &lt;goals&gt;\n                &lt;goal&gt;integration-test&lt;\/goal&gt;\n                &lt;goal&gt;verify&lt;\/goal&gt;\n            &lt;\/goals&gt;\n        &lt;\/execution&gt;\n    &lt;\/executions&gt;\n&lt;\/plugin&gt;\n<\/pre>\n<p>\u305d\u3057\u3066\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u306e\u3088\u3046\u306bverify\u30d5\u30a7\u30fc\u30ba\u307e\u3067\u5b9f\u884c\u3059\u308b\u3068\u7d50\u5408\u30c6\u30b9\u30c8(\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u30af\u30e9\u30b9\u540d\u306e\u672b\u5c3e\u304cIT\u306e\u3082\u306e)\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true \">$ mvn clean verify<\/pre>\n<p>\u5b9f\u884c\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">2014-12-06 11:34:35 INFO  EchoServer - Message Received: 2540bcd1-1c8b-437b-84fa-5bdeea5e0727\n2014-12-06 11:34:35 INFO  EchoServer - Message Received: 6546556b-b005-4af7-a396-bdfda4ecec72\n2014-12-06 11:34:35 INFO  EchoServer - Message Received: 9eccfeb7-2d0e-49b3-8984-da3779324443\n2014-12-06 11:34:35 INFO  EchoServer - Message Received: ff7bbed6-f1c3-4377-badc-d8fa17b9164d\n2014-12-06 11:34:35 INFO  EchoServer - Message Received: 8a3ec862-a5bc-4297-9539-3767907068db\n2014-12-06 11:34:35 INFO  EchoServer - Message Received: f7c0f8d3-b99d-4c17-9cf8-749c3245dd46<\/pre>\n<h3>\u30c7\u30d7\u30ed\u30a4<\/h3>\n<p>\u30c7\u30d7\u30ed\u30a4\u306e\u65b9\u6cd5\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u3054\u3068\u306b\u69d8\u3005\u3067\u3059\u304c\u3001Maven\u304b\u3089\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308bcargo-maven2-plugin\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u4eca\u56de\u306f\u4f8b\u3068\u3057\u3066Tomcat8\u306b\u30c7\u30d7\u30ed\u30a4\u3057\u3066\u307f\u307e\u3059\u3002\u6700\u8fd1\u306eServlet\u30b3\u30f3\u30c6\u30ca\u3067\u3042\u308c\u3070\u307b\u3068\u3093\u3069\u304cJSR356\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u306e\u3067\u4ed6\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u3067\u8a66\u3057\u3066\u6027\u80fd\u6bd4\u8f03\u3059\u308b\u306e\u3082\u9762\u767d\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u5148\u306bTomcat8\u306bcargo-maven2-plugin\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u305f\u3081\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u3063\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002$CATALINA_HOME\/conf\/tomcat-users.xml\u306b\u4ee5\u4e0b\u306e\u8a18\u8ff0\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;tomcat-users&gt;\n    &lt;user username=\"deployer\" password=\"passwd\" roles=\"manager-script\" \/&gt;\n&lt;\/tomcat-users&gt;\n<\/pre>\n<p>\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u5b9a\u7fa9\u306f\u3053\u306e\u3088\u3046\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u30b3\u30f3\u30c6\u30ca\u306eID\u3084\u30c7\u30d7\u30ed\u30a4\u5148\u306e\u30db\u30b9\u30c8\u306e\u60c5\u5831\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:xhtml decode:true\" title=\"pom.xml\">&lt;plugin&gt;\n    &lt;groupId&gt;org.codehaus.cargo&lt;\/groupId&gt;\n    &lt;artifactId&gt;cargo-maven2-plugin&lt;\/artifactId&gt;\n    &lt;version&gt;1.4.10&lt;\/version&gt;\n    &lt;configuration&gt;\n        &lt;container&gt;\n            &lt;containerId&gt;tomcat8x&lt;\/containerId&gt;\n            &lt;type&gt;remote&lt;\/type&gt;\n        &lt;\/container&gt;\n        &lt;configuration&gt;\n            &lt;type&gt;runtime&lt;\/type&gt;\n            &lt;properties&gt;\n                &lt;cargo.hostname&gt;${cargo.hostname}&lt;\/cargo.hostname&gt;\n                &lt;cargo.remote.username&gt;${cargo.remote.username}&lt;\/cargo.remote.username&gt;\n                &lt;cargo.remote.password&gt;${cargo.remote.password}&lt;\/cargo.remote.password&gt;\n            &lt;\/properties&gt;\n        &lt;\/configuration&gt;\n    &lt;\/configuration&gt;\n&lt;\/plugin&gt;\n<\/pre>\n<p>\u30c7\u30d7\u30ed\u30a4\u5148\u306e\u60c5\u5831\u306f\u74b0\u5883\u306b\u3088\u3063\u3066\u7570\u306a\u308b\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3001\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u306b\u5206\u5272\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:xhtml decode:true\" title=\"pom.xml\">&lt;profile&gt;\n    &lt;id&gt;development-environment&lt;\/id&gt;\n    &lt;properties&gt;\n        &lt;cargo.hostname&gt;localhost&lt;\/cargo.hostname&gt;\n        &lt;cargo.remote.username&gt;deployer&lt;\/cargo.remote.username&gt;\n        &lt;cargo.remote.password&gt;passwd&lt;\/cargo.remote.password&gt;\n    &lt;\/properties&gt;\n&lt;\/profile&gt;\n<\/pre>\n<p>\u305d\u3057\u3066\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u306e\u3088\u3046\u306b-P\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3057\u3066cargo:deploy\u30b4\u30fc\u30eb\u3092\u5b9f\u884c\u3059\u308b\u3068\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u306b\u30c7\u30d7\u30ed\u30a4\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true \">$ mvn clean package cargo:deploy -Pdevelopment-environment<\/pre>\n<p>\u3061\u306a\u307f\u306b\u30a2\u30f3\u30c7\u30d7\u30ed\u30a4\u306fcargo:undeploy\u3001\u518d\u30c7\u30d7\u30ed\u30a4\u306fcargo:redeploy\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>JUnit\u3092JMeter\u3067\u5b9f\u884c\u3059\u308b<\/h2>\n<p>JUnit\u3067\u8a18\u8ff0\u3055\u308c\u305f\u7d50\u5408\u30c6\u30b9\u30c8\u3092\u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u3068\u3057\u3066JMeter\u4e0a\u3067\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u30c6\u30b9\u30c8\u5185\u5bb9\u306f\u7d50\u5408\u30c6\u30b9\u30c8\u3068\u540c\u3058\u3082\u306e\u3092\u5b9f\u884c\u3059\u308b\u306e\u3067\u7d99\u627f\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u7d50\u5408\u30c6\u30b9\u30c8\u3067\u306f\u30c6\u30b9\u30c8\u30e9\u30f3\u30ca\u30fc\u306bArquillian\u3092\u4f7f\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u8ca0\u8377\u30c6\u30b9\u30c8\u3067\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306eJUnit4\u306b\u623b\u3057\u307e\u3059\u3002\u305d\u3057\u3066@Before\u3067\u63a5\u7d9a\u5148\u306eURL\u3092\u30d7\u30ed\u30d1\u30c6\u30a3\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u8aad\u307f\u8fbc\u3080\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:java decode:true \" title=\"EchoEndpointST\">@RunWith(JUnit4.class)\npublic class EchoEndpointST extends EchoEndpointIT {\n    @Before\n    @SneakyThrows\n    public void before() {\n        this.url = new URL(ResourceBundle.getBundle(\"stress-test\").getString(\"url\"));\n    }\n}\n<\/pre>\n<p>stress-test.properties\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066Maven\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u7f6e\u63db\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"decode:true\" title=\"stress-test.properties\">url=http:\/\/${cargo.hostname}:8080\/${project.artifactId}<\/pre>\n<h3>GUI\u3067\u5b9f\u884c<\/h3>\n<p>JUnit\u3092JMeter\u3067\u5b9f\u884c\u3059\u308b\u306b\u306f\u4e8b\u524d\u306b\u95a2\u9023\u3059\u308bjar\u30d5\u30a1\u30a4\u30eb\u3092$JMETER_HOME\/lib\/junit\u306b\u30b3\u30d4\u30fc\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u5fc5\u8981\u306ajar\u30d5\u30a1\u30a4\u30eb\u306f\u3001<\/p>\n<pre class=\"lang:sh decode:true\">$ mvn clean test jar:jar jar:test-jar dependency:copy-dependencies<\/pre>\n<p>\u3067target\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u751f\u6210\u3055\u308c\u308b\u306e\u3067\u305d\u308c\u3092\u30b3\u30d4\u30fc\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30b3\u30d4\u30fc\u304c\u3067\u304d\u305f\u3089JMeter\u3092\u8d77\u52d5\u3057\u3066\u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002Test Plan\u306e\u4e0b\u306bThread Group\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u4e0b\u306bJUnit Request\u3092\u3076\u3089\u4e0b\u3052\u308b\u30b7\u30f3\u30d7\u30eb\u306a\u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u3067\u3059\u3002\u5fc5\u8981\u304c\u3042\u308c\u3070\u78ba\u8a8d\u7528\u306e\u30ea\u30b9\u30ca\u30fc\u3082\u4f5c\u6210\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-12498\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.19-AM-600x353.png\" alt=\"Screen Shot 2014-12-06 at 11.24.19 AM\" width=\"600\" height=\"353\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.19-AM-600x353.png 600w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.19-AM-276x162.png 276w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.19-AM-830x488.png 830w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.19-AM.png 1392w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>JUnit Request\u30b5\u30f3\u30d7\u30e9\u30fc\u306e\u8a2d\u5b9a\u3067Classname\u3068Test Method\u306b\u5148\u307b\u3069\u8a18\u8ff0\u3057\u305f\u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002\u3053\u306e\u72b6\u614b\u3067\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001<\/p>\n<p><a href=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.05-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-12499\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.05-AM-600x353.png\" alt=\"Screen Shot 2014-12-06 at 11.24.05 AM\" width=\"600\" height=\"353\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.05-AM-600x353.png 600w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.05-AM-276x162.png 276w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.05-AM-830x488.png 830w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-06-at-11.24.05-AM.png 1392w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u5b9f\u884c\u7d50\u679c\u304c\u30ea\u30b9\u30ca\u30fc\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308c\u3070\u6210\u529f\u3067\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u306b\u3082\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u78ba\u8a8d\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u30ea\u30e2\u30fc\u30c8\u306e\u30b5\u30fc\u30d0\u30fc\u3067\u5b9f\u884c<\/h3>\n<p>\u8907\u6570\u53f0\u306e\u30b5\u30fc\u30d0\u30fc\u3092\u4f7f\u3063\u3066JMeter\u306e\u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u3092\u5206\u6563\u5b9f\u884c\u3059\u308b\u306b\u306f\u3001\u305d\u308c\u305e\u308c\u306e\u30b5\u30fc\u30d0\u30fc\u3067jmeter-server\u3092\u8d77\u52d5\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u78ba\u8a8d\u3060\u3051\u306a\u306e\u3067\u30ed\u30fc\u30ab\u30eb\u30db\u30b9\u30c8\u3067jmeter-server\u3092\u8d77\u52d5\u3057\u3066\u8a66\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>jmeter\u30b3\u30de\u30f3\u30c9\u306b-n\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u3064\u3051\u308b\u3068CUI\u3067\u8d77\u52d5\u3057\u307e\u3059\u3002-t\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u5b9f\u884c\u3059\u308b\u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u3001-R\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u5206\u6563\u5b9f\u884c\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u306e\u30db\u30b9\u30c8\u540d\u3067\u3059\u3002\u8907\u6570\u53f0\u3067\u5b9f\u884c\u3059\u308b\u5834\u5408\u306f\u30ab\u30f3\u30de\u533a\u5207\u308a\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">$ jmeter-server &amp;\n$ jmeter -n -t src\/test\/jmeter\/com.github.nagaseyasuhito.sample.jmeter.EchoEndpointST.jmx -R localhost\n\nCreating summariser &lt;summary&gt;\nCreated the tree successfully using src\/test\/jmeter\/com.github.nagaseyasuhito.sample.jmeter.EchoEndpointST.jmx\nConfiguring remote engine for localhost\nUsing remote object: UnicastRef [liveRef: [endpoint:[192.168.1.1:60469](remote),objID:[1677e58d:14a1d8da86d:-7fff, -8443313415864415409]]]\nStarting remote engines\nStarting the test @ Sat Dec 06 12:04:44 JST 2014 (1417835084121)\nRemote engines have been started\nWaiting for possible shutdown message on port 4445\nsummary +      2 in     2s =    1.3\/s Avg:   861 Min:   582 Max:  1141 Err:     0 (0.00%) Active: 0 Started: 10 Finished: 10\nsummary +     98 in  15.4s =    6.3\/s Avg:   987 Min:   288 Max:  1644 Err:     0 (0.00%) Active: 0 Started: 10 Finished: 10\nsummary =    100 in    17s =    6.0\/s Avg:   985 Min:   288 Max:  1644 Err:     0 (0.00%)\nTidying up remote @ Sat Dec 06 12:05:02 JST 2014 (1417835102209)\n... end of run<\/pre>\n<p>\u5404\u30b5\u30fc\u30d0\u30fc\u53f0\u6570\u3067\u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u304c\u5b9f\u884c\u3055\u308c\u308b\u306e\u3067\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002\u4f8b\u3048\u307010\u30b9\u30ec\u30c3\u30c910\u30eb\u30fc\u30d7\u3059\u308b\u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u309210\u53f0\u306b\u5206\u6563\u3057\u3066\u5b9f\u884c\u3059\u308b\u3068\u5408\u8a0810000\u56de\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>Maven\u304b\u3089JMeter\u3092\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h2>\n<p>\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3084\u7d50\u5408\u30c6\u30b9\u30c8\u3001\u30c7\u30d7\u30ed\u30a4\u306a\u3069\u3092Maven\u3067\u81ea\u52d5\u5316\u3059\u308b\u306a\u3089\u8ca0\u8377\u30c6\u30b9\u30c8\u3082\u81ea\u52d5\u5316\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u3087\u3046\u3002Maven\u306b\u306fJMeter\u3092\u5b9f\u884c\u3059\u308bjmeter-maven-plugin\u3068\u3044\u3046\u3053\u308c\u307e\u305f\u4fbf\u5229\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:xhtml decode:true\" title=\"pom.xml\">&lt;plugin&gt;\n    &lt;groupId&gt;com.lazerycode.jmeter&lt;\/groupId&gt;\n    &lt;artifactId&gt;jmeter-maven-plugin&lt;\/artifactId&gt;\n    &lt;version&gt;1.10.0&lt;\/version&gt;\n    &lt;executions&gt;\n        &lt;execution&gt;\n            &lt;id&gt;jmeter-tests&lt;\/id&gt;\n            &lt;phase&gt;integration-test&lt;\/phase&gt;\n            &lt;goals&gt;\n                &lt;goal&gt;jmeter&lt;\/goal&gt;\n            &lt;\/goals&gt;\n        &lt;\/execution&gt;\n    &lt;\/executions&gt;\n    &lt;configuration&gt;\n        &lt;testFilesDirectory&gt;${project.build.testOutputDirectory}&lt;\/testFilesDirectory&gt;\n        &lt;testResultsTimestamp&gt;false&lt;\/testResultsTimestamp&gt;\n        &lt;ignoreResultFailures&gt;true&lt;\/ignoreResultFailures&gt;\n        &lt;suppressJMeterOutput&gt;false&lt;\/suppressJMeterOutput&gt;\n        &lt;remoteConfig&gt;\n            &lt;startServersBeforeTests&gt;true&lt;\/startServersBeforeTests&gt;\n            &lt;serverList&gt;${jmeter.servers}&lt;\/serverList&gt;\n            &lt;stopServersAfterTests&gt;true&lt;\/stopServersAfterTests&gt;\n        &lt;\/remoteConfig&gt;\n    &lt;\/configuration&gt;\n&lt;\/plugin&gt;\n<\/pre>\n<p>\u4e0a\u8a18\u306e\u8a2d\u5b9a\u3067integration-test\u30d5\u30a7\u30fc\u30ba\u3067JMeter\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u8a2d\u5b9a\u306f\u305d\u308c\u305e\u308c<\/p>\n<ul>\n<li>testFilesDirectory ... \u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<\/li>\n<li>testResultsTimestamp ... \u7d50\u679c\u30d5\u30a1\u30a4\u30eb\u306b\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u3092\u4f7f\u3046\u304b<\/li>\n<li>ignoreResultFailures ... \u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u304c\u5931\u6557\u3057\u3066\u3082Maven\u306e\u51e6\u7406\u3092\u7d9a\u3051\u308b\u304b<\/li>\n<li>suppressJMeterOutput ... JMeter\u306e\u51fa\u529b\u3092\u6291\u5236\u3059\u308b\u304b<\/li>\n<li>remoteConfig\/startServersBeforeTests ... \u3061\u3087\u3063\u3068\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u3051\u3069true\u306b\u3057\u3066\u304a\u304f\u3068\u5206\u6563\u5b9f\u884c\u3055\u308c\u308b<\/li>\n<li>remoteConfig\/serverList ... \u5206\u6563\u5b9f\u884c\u3059\u308b\u30b5\u30fc\u30d0\u30fc<\/li>\n<li>remoteConfig\/stopServersAfterTests ... \u5206\u6563\u5b9f\u884c\u5f8cjmeter-server\u3092\u7d42\u4e86\u3059\u308b\u304b<\/li>\n<\/ul>\n<p>\u3053\u308c\u3060\u3051\u3067\u8a2d\u5b9a\u7d42\u308f\u308a\uff01\u306b\u306a\u308c\u3070\u3068\u3066\u3082\u697d\u306a\u306e\u3067\u3059\u304c\u3001\u5148\u8ff0\u3057\u305f\u901a\u308ajar\u30d5\u30a1\u30a4\u30eb\u3092\u5206\u6563\u5b9f\u884c\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u306b\u30b3\u30d4\u30fc\u3057\u3066jmeter-server\u3092\u8d77\u52d5\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3055\u3059\u304c\u306b\u305d\u3093\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u7121\u3044\u306e\u3067maven-exec-plugin\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true \" title=\"setup-jmeter-server.sh\">#!\/bin\/sh\n\nIFS=\",\"\nSERVERS=\"${jmeter.servers}\"\nDESTINATION=\"${jmeter.home}\/lib\/junit\"\n\nfor SERVER in $SERVERS; do\n    HOST=\"${jmeter.user}@$SERVER\"\n\n    ssh $HOST \"rm -rf $DESTINATION\/*\"\n\n    scp -r ${project.build.directory}\/dependency\/* $HOST:$DESTINATION\n    scp ${project.build.directory}\/${project.build.finalName}.jar $HOST:$DESTINATION\n    scp ${project.build.directory}\/${project.build.finalName}-tests.jar $HOST:$DESTINATION\n    \n    ssh $HOST \"nohup ${jmeter.home}\/bin\/jmeter-server &gt; ${jmeter.home}\/stdout.log 2&gt; ${jmeter.home}\/stderr.log &lt; \/dev\/null &amp;\"\ndone\n<\/pre>\n<p>\u3053\u308c\u3082Maven\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u7f6e\u63db\u3067scp\u5148\u306a\u3069\u3092\u6307\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u307e\u305f\u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u306eThread Group\u306e\u8a2d\u5b9a\u3082Maven\u5b9f\u884c\u6642\u306b\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:xhtml decode:true\" title=\"com.github.nagaseyasuhito.sample.jmeter.EchoEndpointST.jmx\">      &lt;ThreadGroup guiclass=\"ThreadGroupGui\" testclass=\"ThreadGroup\" testname=\"Thread Group\" enabled=\"true\"&gt;\n        &lt;stringProp name=\"ThreadGroup.on_sample_error\"&gt;continue&lt;\/stringProp&gt;\n        &lt;elementProp name=\"ThreadGroup.main_controller\" elementType=\"LoopController\" guiclass=\"LoopControlPanel\" testclass=\"LoopController\" testname=\"Loop Controller\" enabled=\"true\"&gt;\n          &lt;boolProp name=\"LoopController.continue_forever\"&gt;false&lt;\/boolProp&gt;\n          &lt;stringProp name=\"LoopController.loops\"&gt;${jmeter.loopCount}&lt;\/stringProp&gt;\n        &lt;\/elementProp&gt;\n        &lt;stringProp name=\"ThreadGroup.num_threads\"&gt;${jmeter.numberOfThreads}&lt;\/stringProp&gt;\n        &lt;stringProp name=\"ThreadGroup.ramp_time\"&gt;${jmeter.rampUpPeriod}&lt;\/stringProp&gt;\n      &lt;\/ThreadGroup&gt;\n<\/pre>\n<p>\u3053\u3046\u3057\u3066\u304a\u304f\u3068Maven\u5b9f\u884c\u6642\u306b<\/p>\n<pre class=\"lang:sh decode:true\">$ mvn clean verify -Djmeter.numberOfThreads=7000 -Djmeter.loopCount=1 -Djmeter.rampUpPeriod=60<\/pre>\n<p>\u306e\u3088\u3046\u306b\u8ca0\u8377\u3092\u8abf\u6574\u3057\u306a\u304c\u3089\u5b9f\u884c\u3067\u304d\u307e\u3059\u30025\u53f0\u306e\u30b5\u30fc\u30d0\u30fc\u3092jmeter-server\u7528\u306b\u6e96\u5099\u3057\u3066\u4e0a\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3066\u307f\u307e\u3057\u305f\u30027000\u30b9\u30ec\u30c3\u30c9\u00d75\u53f0\u309260\u79d2\u3067\u8d77\u52d5\u3059\u308b\u30b7\u30ca\u30ea\u30aa\u3067\u3059\u3002\u3057\u3070\u3089\u304f\u3059\u308b\u3068\u3001<\/p>\n<pre class=\"lang:default decode:true \">[INFO] --- jmeter-maven-plugin:1.10.0:jmeter (default) @ sample-jmeter ---\n[INFO]\n[INFO] -------------------------------------------------------\n[INFO]  P E R F O R M A N C E    T E S T S\n[INFO] -------------------------------------------------------\n[INFO]\n[INFO]\n[info]\n[debug] JMeter is called with the following command line arguments: -n -t \/home\/nagaseyasuhito\/sample-jmeter\/target\/test-classes\/com.github.nagaseyasuhito.sample.jmeter.EchoEndpointST.jmx -l \/home\/nagaseyasuhito\/sample-jmeter\/target\/jmeter\/results\/com.github.nagaseyasuhito.sample.jmeter.EchoEndpointST.jtl -d \/home\/nagaseyasuhito\/sample-jmeter\/target\/jmeter -j \/home\/nagaseyasuhito\/sample-jmeter\/target\/jmeter\/logs\/com.github.nagaseyasuhito.sample.jmeter.EchoEndpointST.jmx.log -r -R 192.168.1.1,192.168.1.2,192.168.1.3,192.168.1.4,192.168.1.5 -X -Dsun.net.http.allowRestrictedHeaders true\n[info] Executing test: com.github.nagaseyasuhito.sample.jmeter.EchoEndpointST.jmx\n[info] Creating summariser &lt;summary&gt;\n[info] Created the tree successfully using \/home\/nagaseyasuhito\/sample-jmeter\/target\/test-classes\/com.github.nagaseyasuhito.sample.jmeter.EchoEndpointST.jmx\n[info] Configuring remote engine for 192.168.1.1\n[info] Using remote object: UnicastRef [liveRef: [endpoint:[192.168.1.1:41991](remote),objID:[-56618c96:14a2a6931ba:-7fff, 6093428288341961798]]]\n[info] Configuring remote engine for 192.168.1.2\n[info] Using remote object: UnicastRef [liveRef: [endpoint:[192.168.1.2:51855](remote),objID:[217ab7d0:14a2a6987ea:-7fff, -6442079714823894686]]]\n[info] Configuring remote engine for 192.168.1.3\n[info] Using remote object: UnicastRef [liveRef: [endpoint:[192.168.1.3:56093](remote),objID:[-50066af2:14a2a698a83:-7fff, 1526694257218326723]]]\n[info] Configuring remote engine for 192.168.1.4\n[info] Using remote object: UnicastRef [liveRef: [endpoint:[192.168.1.4:57981](remote),objID:[19b2eb4a:14a2a698d43:-7fff, 6486487486601975473]]]\n[info] Configuring remote engine for 192.168.1.5\n[info] Using remote object: UnicastRef [liveRef: [endpoint:[192.168.1.5:52170](remote),objID:[-545dac85:14a2a698ffb:-7fff, 5608046978234053081]]]\n[info] Starting remote engines\n[info] Starting the test @ Mon Dec 08 23:59:33 JST 2014 (1418050773240)\n[info] Remote engines have been started\n[info] Waiting for possible shutdown message on port 4445\n[info] summary +      1 in     1s =    1.4\/s Avg:   705 Min:   705 Max:   705 Err:     0 (0.00%) Active: 360 Started: 329 Finished: 21\n[info] summary +  13605 in    26s =  530.0\/s Avg:   176 Min:     2 Max:  6501 Err:     0 (0.00%) Active: 3 Started: 13857 Finished: 13906\n[info] summary =  13606 in    26s =  530.0\/s Avg:   176 Min:     2 Max:  6501 Err:     0 (0.00%)\n[info] summary +  16100 in    31s =  527.6\/s Avg:     3 Min:     2 Max:    89 Err:     0 (0.00%) Active: 2 Started: 29966 Finished: 30016\n[info] summary =  29706 in    56s =  534.8\/s Avg:    82 Min:     2 Max:  6501 Err:     0 (0.00%)\n[info] summary +   5294 in    12s =  449.2\/s Avg:     2 Min:     2 Max:    29 Err:     0 (0.00%) Active: 0 Started: 34948 Finished: 35000\n[info] summary =  35000 in    67s =  525.1\/s Avg:    70 Min:     2 Max:  6501 Err:     0 (0.00%)\n[info] Tidying up remote @ Tue Dec 09 00:00:40 JST 2014 (1418050840917)\n[info] Exitting remote servers\n[info] ... end of run\n[info] Completed Test: com.github.nagaseyasuhito.sample.jmeter.EchoEndpointST.jmx\n[INFO]\n[INFO] Test Results:\n[INFO]\n[INFO] Tests Run: 1, Failures: 0<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306b\u30b5\u30de\u30ea\u30fc\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002JMeter\u306e\u5b9f\u884c\u7d50\u679c\u306f\u30d5\u30a1\u30a4\u30eb\u306b\u3082\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001JMeter\u3067\u958b\u3044\u3066\u30b0\u30e9\u30d5\u5316\u3059\u308b\u4e8b\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>Jenkins\u3067\u30ec\u30dd\u30fc\u30c8\u51fa\u529b\u3059\u308b<\/h2>\n<p>Jenkins\u306b<a href=\"http:\/\/wiki.jenkins-ci.org\/display\/JENKINS\/Performance+Plugin\" target=\"_blank\">Performance Plugin<\/a>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068JMeter\u306e\u5b9f\u884c\u7d50\u679c\u3092Jenkins\u4e0a\u3067\u30b0\u30e9\u30d5\u5316\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Jenkins.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-12629\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Jenkins-500x400.png\" alt=\"Jenkins\" width=\"500\" height=\"400\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Jenkins-500x400.png 500w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Jenkins-250x200.png 250w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Jenkins-830x664.png 830w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2014\/12\/Jenkins.png 1280w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068Post-build Action\u306bPublish Performance test result report\u3068\u3044\u3046\u9805\u76ee\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002Add a new report\u3088\u308aJMeter\u3092\u9078\u629e\u3057\u3066Report files\u306b**\/*.jtl\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u3051\u3070\u3001Jenkins\u304b\u3089\u8ca0\u8377\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3001\u7d50\u679c\u3092\u95b2\u89a7\u3059\u308b\u3068\u3053\u308d\u307e\u30671-click\u3067\u884c\u3048\u308b\u3088\u3046\u306b\u306a\u308b\u306e\u3067\u8ca0\u8377\u30c6\u30b9\u30c8\u3092\u7d99\u7d9a\u7684\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u304a\u307e\u3051 JMeter\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092JUnit\u306b\u6e21\u3059\u306b\u306f<\/h2>\n<p>JUnit\u306e\u30c6\u30b9\u30c8\u306bJMeter\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u6e21\u3057\u305f\u3044\u5834\u5408\u3001JUnitSampler\u306eConstructor String Label\u3068\u3044\u3046\u6a5f\u80fd\u3092\u4f7f\u3044\u307e\u3059\u3002JUnit\u306e\u30c6\u30b9\u30c8\u306bString\u306e\u5f15\u6570\u3092\u3068\u308b\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u5b9a\u7fa9\u3059\u308b\u3068\u3001\u8ca0\u8377\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u306eConstructor String Label\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u305d\u306e\u5024\u304c\u6e21\u3055\u308c\u307e\u3059\u3002JMeter\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u7f6e\u63db\u3082\u884c\u308f\u308c\u308b\u306e\u3067\u30eb\u30fc\u30d7\u306e\u56de\u6570\u3084\u30b9\u30ec\u30c3\u30c9\u306eID\u306a\u3069\u3082JUnit\u5074\u3067\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u304a\u307e\u3051 FlightRecoder\u3067\u8abf\u67fb<\/h2>\n<p>\u8ca0\u8377\u30c6\u30b9\u30c8\u306e\u969b\u3069\u3053\u304c\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u8abf\u67fb\u3059\u308b\u305f\u3081\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u306f\u6b20\u304b\u305b\u307e\u305b\u3093\u3002\u6700\u8fd1\u306eJava\u3067\u6a19\u6e96\u88c5\u5099\u306b\u306a\u3063\u305fFlightRecorder\u3092\u4f7f\u3046\u5834\u5408\u3001Tomcat8\u3067\u3042\u308c\u3070$CATALINA_HOME\/bin\/setenv.sh\u306b<\/p>\n<pre class=\"lang:default decode:true\">JAVA_OPTS=\"-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true,dumponexitpath=\/home\/nagaseyasuhito\/sample-jmeter.jfr\"<\/pre>\n<p>\u3068\u8a18\u8ff0\u3057\u3066\u304a\u304f\u3068Tomcat8\u3092\u7d42\u4e86\u3057\u305f\u969b\u306b\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u306e\u7d50\u679c\u304cdumponexitpath\u3067\u6307\u5b9a\u3057\u305f\u30d1\u30b9\u306b\u4fdd\u5b58\u3055\u308c\u308b\u306e\u3067\u3001\u624b\u5143\u306e\u30de\u30b7\u30f3\u306eJava Mission Control\u3067\u958b\u3044\u3066\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u306e\u8abf\u67fb\u3092\u3059\u308b\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u3044\u304b\u304c\u3060\u3063\u305f\u3067\u3057\u3087\u3046\u304b\u3002\u672c\u756a\u74b0\u5883\u306b\u8fd1\u3044\u5341\u5206\u306a\u8ca0\u8377\u304c\u304b\u3051\u3089\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u521d\u3081\u3066\u8ca0\u8377\u30c6\u30b9\u30c8\u306e\u30b9\u30bf\u30fc\u30c8\u30e9\u30a4\u30f3\u306b\u7acb\u3063\u305f\u3088\u3046\u306a\u3082\u306e\u3067\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3060\u3051\u3067\u306f\u306a\u304f\u3001\u30ab\u30fc\u30cd\u30eb\u3084\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u542b\u3081\u305f\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u3053\u305d\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u8155\u306e\u898b\u305b\u3069\u3053\u308d\u3067\u3059\u306d\u3002<\/p>\n<p>\u5341\u5206\u306a\u8ca0\u8377\u30c6\u30b9\u30c8\u3092\u305b\u305a\u672c\u756a\u904b\u7528\u304c\u59cb\u307e\u3063\u3066\u304b\u3089\u904e\u8ca0\u8377\u306b\u3088\u308b\u30b5\u30fc\u30d3\u30b9\u505c\u6b62\u3068\u3044\u3063\u305f\u4e0d\u5e78\u306a\u4e8b\u4ef6\u3092\u8d77\u3053\u3055\u306a\u3044\u305f\u3081\u3001\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u3092\u304d\u3063\u304b\u3051\u306b\u672c\u756a\u74b0\u5883\u306b\u8fd1\u3044\u8ca0\u8377\u3092\u304b\u3051\u305f\u30c6\u30b9\u30c8\u304c\u3088\u308a\u8eab\u8fd1\u306a\u3082\u306e\u306b\u306a\u308a\u3001\u7686\u69d8\u306e\u30b5\u30fc\u30d3\u30b9\u54c1\u8cea\u306e\u5411\u4e0a\u306b\u3064\u306a\u304c\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n<p>\u660e\u65e5\u306f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u30b9\u30da\u30b7\u30e3\u30ea\u30b9\u30c8\u3001\u9ed2\u6cb3\u5185\u3055\u3093\u306e\u305f\u3076\u3093\u306a\u3093\u304b\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u7cfb\u306e\u8a71\u3067\u3059\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u30a4\u30f3\u30d5\u30e9\u30b9\u30c8\u30e9\u30af\u30c1\u30e3\u672c\u90e8\u306e@nagaseyasuhito\u3067\u3059\u3002\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u306f GREE Advent Calendar 2014 10\u65e5\u76ee\u306e\u8a18\u4e8b\u3067\u3059\u3002\u6628\u65e5\u306f\u30a4\u30b1\u30e1\u30f3morita\u3055\u3093\u306b\u3088\u308b\u7537\u6027\u30a8\u30f3\u30b8\u30cb\u30a2\u30ea\u30f3\u30b0\u30de [&hellip;]<\/p>\n","protected":false},"author":120,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[54,47,42],"class_list":["post-12037","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-advent-calendar","tag-java","tag-jenkins"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/12037","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/users\/120"}],"replies":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/comments?post=12037"}],"version-history":[{"count":3,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/12037\/revisions"}],"predecessor-version":[{"id":12650,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/12037\/revisions\/12650"}],"wp:attachment":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/media?parent=12037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/categories?post=12037"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/tags?post=12037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}