python, mock-server of moco

python, mock-server of Moco
1.mock use:
the mock except that the testing unit, and a use-side developer in the development of the current page, the server needs to provide an interface API, the server is not developed this time, or did not set up a test environment, this time a front-end development on their own mock api server, provide for ourselves call interface return data.
mock-server use is developed in the development process, the need to rely on part of the interface, but they did not provide or environmental circumstances, etc.
2. Environmental ready
    1.moco-Runner-0.12.0-standalone.jar
    2.java version 1.8. 0_20

3.Moco environment to build
1.) moco is an open source framework that can be downloaded to on github, github source address https://github.com/dreamhead/moco
latest version is moco-runner-0.12.0-standalone .jar,
http://central.maven.org/maven2/com/github/dreamhead/moco-runner/0.12.0/moco-runner-0.12.0-standalone.jar

2.) the download is complete, save to your computer a local directory, then create a new file in the same directory foo.json, which write the following:

[
  {
    "Response":
      {
        "text": "! Moco the Hello World!"
      }
  }
]

3.) Next start moco service, open the file moco-runner-0.12.0-standalone.jar folder where the directory (E: \ moco), upper left corner of the address bar type cmd, and press Enter to open cmd window

    java -jar moco-runner-0.12.0-standalone.jar http -p 12306 -c moco.json

appear as the result is the successful launch of the

E: \ moco> java -jar moco -runner-0.12.0-standalone.jar http -p 12306 moco.json -c
22 Jul 21:44:36 2018 [main] INFO Server Started iS AT 12306
22 Jul 21:44:37 2018 [main] INFO iS 62 459 Port Shutdown

4.) open the Firefox browser address bar enter: http: // localhost: 123456 / see page displays "Hello World moco!!", explained mock-server environment to build a successful

5) official document:
https://github.com/dreamhead/moco

Guess you like

Origin www.cnblogs.com/lisa2016/p/12069129.html