启动和运行

启动桩数据

首先需要启动桩数据,进入目录 DevOpts/mockstar-app/ ,运行如下命令:

# 安装依赖
npm i

# 运行服务器
npm start

看到如下的输出,说明mockstar运行成功

> mockstar-app@ start /Users/remozhang/remozhang/git/matman-demo/DevOpts/mockstar-app
> mockstar start --watch

Load config file: /Users/remozhang/remozhang/git/matman-demo/DevOpts/mockstar-app/mockstar.config.js
[i] MockStar@1.1.3 is running for /Users/remozhang/remozhang/git/matman-demo/DevOpts/mockstar-app
       http://127.0.0.1:9527
       http://10.64.66.73:9527

代理

whistle安装参见whistle文档

安装之后,就可以开启whistle代理了。

进入目录 DevOpts/whistle/

运行如下命令:

# 运行whistle脚本
./start-dev-8080.sh

看到如下的输出,说明whistle运行成功

Ready to start whistle...
[i] whistle killed.
[i] whistle@1.15.10 started
[i] 1. use your device to visit the following URL list, gets the IP of the URL you can access:
       http://127.0.0.1:8080/
       http://10.64.66.73:8080/
       Note: If all the above URLs are unable to access, check the firewall settings
             For help see https://github.com/avwo/whistle
[i] 2. configure your device to use whistle as its HTTP and HTTPS proxy on IP:8080
[i] 3. use Chrome to visit http://local.whistlejs.com/ to get started
Setting whistle[127.0.0.1:8080] rules successful.

这样代理的准备工作就完成了

启动项目

控制台/终端切到主目录下,运行如下命令

# 安装依赖
npm i

# 运行项目
npm start

开始测试

控制台/终端切到matman-app目录下,运行如下命令:

# 安装依赖
npm i

# 编译爬虫脚本
npm run build

# 开始测试
npm test

然后测试就开始了。

Last updated

Was this helpful?