Nablarch-example-restを起動した状態でKarate-Gatlingテストを実行する


```xml:pom.xml
<dependencies>

    <dependency>
      <groupId>com.intuit.karate</groupId>
      <artifactId>karate-apache</artifactId>
      <version>0.9.6</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.intuit.karate</groupId>
      <artifactId>karate-junit5</artifactId>
      <version>0.9.6</version>
      <scope>test</scope>
    </dependency>

</dependencies>
```

```Gherkin:karatesample.feature
Feature: Karate sample

Background:
Feature: Karate sample

Background:
* url urlBase

Scenario: Get items

Given path "projects"
And header Accept = 'application/json'
When method get
* print response
Then status 200
  And match response == '#[10]'
# resposnse10件
```

```js:karate-config.js
function() {
  var config = {
      urlBase: 'http://localhost:9080/',
  };
  karate.configure('connectTimeout', 5000);
  karate.configure('readTimeout', 5000);
  return config;
}
```
## Gatling
featureは単体実行もできる。

## 注意点
*  scalaファイルのパスを指定しないほうが良いtypoでnotfoundexceptionになることがある。
*  nablarchのlocal実行の場合、execute-ddlとload-dataはスキップする

```Gherkin:karatesample.feature

  Scenario Outline: get
    Given path 'projects'
    And header <name> = <values>
    And form field clientId = <clientId>
    When method <method>
    * print <exps>
    Then status <status>
    And match $ == '#[1]'
    And match <expression>
    Examples:
      | clientId | name | values          | method | exps     | status | expression                |
      | '1' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト００１"}|
      | '2' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト００２"}|
      | '3' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト００３"}|
      | '4' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト００４"}|
      | '5' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト００５"}|
      | '6' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト００６"}|
      | '7' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト００７"}|
      | '8' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト００８"}|
      | '9' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト００９"}|
      | '10' | Accept | 'application/json' | get    | response | 200    | $[0] contains {"projectName": "プロジェクト０１０"}|
```

```scala:KarateSimulation.scala
package com.nablarch.example

import com.intuit.karate.gatling.PreDef._
import io.gatling.core.Predef._

import scala.concurrent.duration._

class KarateSimulation extends Simulation {

    val protocol = karateProtocol()

    protocol.nameResolver = (req, ctx) => req.getUrlAndPath()

    val search = scenario("get").exec(karateFeature("classpath:com/nablarch/example/nablarch.feature"))
    setUp(search.inject(
        rampUsersPerSec(0) to 2 during(20 seconds),
        constantUsersPerSec(2) during(40 seconds)
    ).protocols(protocol))
}
```

```xml:pom.xml

    <!-- KARATE-dependency -->
    <dependency>
      <groupId>com.intuit.karate</groupId>
      <artifactId>karate-apache</artifactId>
      <version>0.9.6</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.intuit.karate</groupId>
      <artifactId>karate-junit4</artifactId>
      <version>0.9.6</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.intuit.karate</groupId>
      <artifactId>karate-gatling</artifactId>
      <version>0.9.6</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>3.0.2</version>
    </dependency>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
      <version>2.12.12</version>
      <scope>provided</scope>
    </dependency>
    <!-- KARATE -->

    <!-- KARATE-maven-plugin -->
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>3.4.4</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <args>
                <arg>-Jbackend:GenBCode</arg>
                <arg>-Jdelambdafy:method</arg>
                <arg>-target:jvm-1.8</arg>
                <arg>-deprecation</arg>
                <arg>-feature</arg>
                <arg>-unchecked</arg>
                <arg>-language:implicitConversions</arg>
                <arg>-language:postfixOps</arg>
              </args>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>3.1.2</version>
        <configuration>
          <disableCompiler>true</disableCompiler>
        </configuration>
        <executions>
          <execution>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

```