基于node.js 的 Express工程,使用mocha、zombie 进行跨页测试。
安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows
PS D:\04_GitHub\nodejs\nodejs-login> npm start
> nodejs-login@0.0.0 start D:\04_GitHub\nodejs\nodejs-login
> node ./bin/www
GET / 200 8.568 ms - 1219
GET /stylesheets/style.css 200 9.714 ms - 119
GET /stylesheets/bootstrap-theme.css 200 5.966 ms - 26719
GET /stylesheets/bootstrap.css 200 9.535 ms - 154230
GET /javascripts/bootstrap.js 200 6.099 ms - 71253
GET /javascripts/jquery.js 200 9.004 ms - 282988
GET /favicon.ico 404 1.953 ms - 1026
登录成功
POST /login 200 21.512 ms - 43
- 参数设置
- 登陆成功
- 登陆失败:密码不能为空
- 登陆失败:用户名或密码不正确
- 参数设置
- 执行结果
- 执行命令
mocha -u tdd -R spec test/zombie.js
- 运行结果
User visits signup page
submits form
√ should be successful
√ should see welcome page
2 passing (264ms)
参考: