System development or Technical something

Try to use Karate Netty as rest api mock

check help

The command is java -jar .\karate-0.9.5.jar -h

PS C:\desk\karate> java -jar .\karate-0.9.5.jar -h
00:27:14.852 [main] INFO  com.intuit.karate.Main - Karate version: 0.9.5
Usage: <main class> [-Chsw] [-d[=<debugPort>]] [-c=<cert>] [-e=<env>]
                    [-i=<importFile>] [-j=<jobServerUrl>] [-k=<key>]
                    [-m=<mock>] [-n=<name>] [-o=<output>] [-p=<port>]
                    [-T=<threads>] [-t=<tags>]... [<tests>...]
      [<tests>...]          one or more tests (features) or search-paths to run
  -c, --cert=<cert>         ssl certificate (default: cert.pem)
  -C, --clean               clean output directory
  -d, --debug[=<debugPort>] debug mode (optional port else dynamically chosen)
  -e, --env=<env>           value of 'karate.env'
  -h, --help                display this help message
  -i, --import=<importFile> import and convert a file
  -j, --jobserver=<jobServerUrl>
                            job server url
  -k, --key=<key>           ssl private key (default: key.pem)
  -m, --mock=<mock>         mock server file
  -n, --name=<name>         scenario name
  -o, --output=<output>     directory where logs and reports are output
                              (default 'target')
  -p, --port=<port>         mock server port (required for --mock)
  -s, --ssl                 use ssl / https, will use 'cert.pem' and 'key.pem'
                              if they exist in the working directory, or
                              generate them
  -t, --tags=<tags>         cucumber tags - e.g. '@smoke,~@ignore'
  -T, --threads=<threads>   number of threads when running tests
  -w, --watch               watch (and hot-reload) mock server file for changes
PS C:\desk\karate>

try API Test-Doubles(Karate Netty) demo

1) check https://intuit.github.io/karate/karate-netty/
2) get demo-mock.feature from https://github.com/intuit/karate/blob/master/karate-demo/src/test/java/mock/proxy/demo-mock.feature
3) start test-double as below
The command is java -jar .\karate-0.9.5.jar -m .\demo-mock.feature -p 18080

PS C:\desk\karate> java -jar .\karate-0.9.5.jar -m .\demo-mock.feature -p 18080
01:04:12.892 [main] INFO  com.intuit.karate.Main - Karate version: 0.9.5
01:04:12.992 [main] ERROR com.intuit.karate.FileUtils - file system creation failed for URI: jar:file:/./karate-0.9.5.jar!/ - C:\.\karate-0.9.5.jar
Warning: Nashorn engine is planned to be removed from a future JDK release
01:04:13.493 [main] INFO  com.intuit.karate - backend initialized
01:04:13.881 [main] INFO  c.intuit.karate.netty.FeatureServer - server started -

4) send request "/greeting"


5) we can find below log in console

01:25:26.555 [nioEventLoopGroup-3-2] DEBUG com.intuit.karate - handling method: GET, uri: /greeting
01:25:26.600 [nioEventLoopGroup-3-2] DEBUG com.intuit.karate - scenario skipped: pathMatches('/greeting') && paramValue('name') != null
01:25:26.608 [nioEventLoopGroup-3-2] DEBUG com.intuit.karate - scenario matched: pathMatches('/greeting')