前端自动化测试解决方案探析(2)

发表于:2016-11-23来源:ouven作者:ouven点击数: 标签:前端
$ npm install mocha$ mkdir test$ $EDITOR test/test.js # or open with your favorite editor 测试用例: var assert = require ( assert ); describe ( Array , function () { describe ( #indexOf() , func

$ npm install mocha
$ mkdir test
$ $EDITOR test/test.js # or open with your favorite editor

  测试用例:

var assert = require('assert');
describe('Array', function() {
  describe('#indexOf()', function() {
    it('should return -1 when the value is not present', function() {
      assert.equal(-1, [1,2,3].indexOf(4));
    });
  });
});

原文转自:http://jixianqianduan.com/frontend-javascript/2016/11/22/front-end-auto-test.html