nodejs unit test related----faker-cli, sinonjs, mock/stub
http://www.tuicool.com/articles/rAnaYvn
http://www.tuicool.com/articles/Y73aYn
(contrast stub and mock in java )http://www.cnblogs.com/TankXiao/archive/2012/03/06/2366073.html
http://shaynegui.com/javascript-unit-test-sinonjs/
http://shaynegui.com/javascript-unit-test-sinonjs/
http://sinonjs.org/docs/#spies
模拟输入可以用Sinon,它可以模拟包括ajax调用的各类程序调用来进行测试。也就是用Faker.js来生成软件测试时所需要的各式各样的数据。
test data generator: Faker.js
npm install -g faker-cli
Nodejs的单元测试工具
测试框架 mocha
断言库:should.js、expect.js、chai
覆盖率:istanbul、jscover、blanket
Mock库:muk
测试私有方法:rewire
Web测试:supertest
持续集成:Travis-cli
QUnit is very easy to get started with, as you only need to include two files(qunit.css and qunit.js) and a little bit of markup, then you can start writing tests. QUnit is TDD style tests.
Jasmine is easier to get started – it’s all-in-one package will generally get you and a team up and testing much faster, and you’ll be in good hands with it. Jasmine is BDD style tests.
Mocha is significantly more flexible, but you have to piece it together yourself. There is no spy framework built in to Mocha, so most people use sinon.js. There’s no assertion framework built in to Mocha either, so you’ll have to pick one. Chai is the popular one, but there are many, many others available. You can also configure Mocha for BDD (jasmine style) or TDD (QUnit style) easily. But you have to pick and choose how you want Mocha to work. This flexibility is great because you can build the test environment that you really want. But it means you have more work to do, more individual pieces to maintain / keep up to date, etc.
nodejs unit test related----faker-cli, sinonjs, mock/stub的更多相关文章
- angular4.0 安装最新版本的nodejs、npm、@angular/cli的方法
在使用ng项目的ui框架时,比如ng-zorro.angular Material,需要安装最新版本的@angular/cli: 配置ng-zorro框架 ng-zorro官网:https://ng. ...
- Method of offloading iSCSI TCP/IP processing from a host processing unit, and related iSCSI TCP/IP offload engine
A method of offloading, from a host data processing unit (205), iSCSI TCP/IP processing of data stre ...
- 置换测试: Mock, Stub 和其他
简介 在理想情况下,你所做的所有测试都是能应对你实际代码的高级测试.例如,UI 测试将模拟实际的用户输入(Klaas 在他的文章中有讨论)等等.实但际上,这并非永远都是个好主意.为每个测试用例都访问一 ...
- iOS測试——置换測试: Mock, Stub 和其它
文章地址:http://ryantang.me/blog/2014/08/21/test-doubles/
- Unit Testing with NSubstitute
These are the contents of my training session about unit testing, and also have some introductions a ...
- nodeJs 5.0.0 安装配置与nodeJs入门例子学习
新手学习笔记,高手请自动略过 安装可以先看这篇:http://blog.csdn.net/bushizhuanjia/article/details/7915017 1.首先到官网去下载exe,或者m ...
- What's the difference between a stub and mock?
I believe the biggest distinction is that a stub you have already written with predetermined behavio ...
- window下Nodejs的部署
nodejs http://nodejs.org/#download npm node cli.js install npm -gf //可以安装最新版的NPM node cli.js install ...
- vue mock自己总结
cli安装mock模块 npm install mockjs 创建mock文件夹 配置及创建文件 当后端写好真实接口以后,我们只需删掉创建的mock.js文件和在main.js中导入假数据的那行 ...
随机推荐
- Vue 中的生命周期和钩子函数
生命周期: beforeCreate:el 和 data 并未初始化 (此方法不常用) created:完成了 data 数据的初始化,el的初始化未完成.用来发送ajax beforeMount:( ...
- 可能是最通俗易懂的 Java 位操作运算讲解
https://blog.csdn.net/briblue/article/details/70296326
- Jetty - Connector源码分析
1. 描述 基于Jetty-9.4.8.v20171121. Connector接受远程机器的连接和数据,允许应用向远程机器发送数据. 1.2 类图 从类图看出AbstractConnector继承C ...
- python django中使用sqlite3数据库 存储二进制数据ByteArray
在python中使用sqlite3数据库存储二进制流数据ByteArray,在django使用sqlite3数据库时,有时候也要注意最好使用二进制流ByteArray插入字符串. 使用ByteArra ...
- nodejs之express的使用
Express是目前最流行的基于Node.js的Web开发框架,可以快速的搭建一个完整功能的网站. Express框架建立在内置的http模块上,http模块生成服务器的原始代码如下. var htt ...
- SecureCRT中 secureCRT使用VIM时对语法高亮
1.在SecureCRT中 secureCRT使用VIM时对语法高亮 其实不是secureCRT的功能,而是VIM的 设置:Options ->Session Options -> Ter ...
- python 的__FILE__,__LINE__功能实现
在C语言里,__FILE__和__LINE__给调试提供了很大的方便,今晚在写PYTHON的时候想到,PYTHON是否有类似的功能实现呢? GOOGLE一番发现两个方法,试验一下下面这句:print ...
- website 合集
1. oracle http://asktom.oracle.com ( 英文 ) http://itpub.net ( 中文 ) https://www.oracle.com/communitie ...
- Matlab之合并音频
程序功能: 1.读入wav下的所有音频 2.每个音频截取前0.6秒 3.合并每个音频 clear all; cd = 'wav'; waveFiles = dir(fullfile(cd,'*.wav ...
- Collection 和 Collections的区别?
Collection 和 Collections的区别? 解答:Collection是java.util下的接口,它是各种集合的父接口,继承于它的接口主要有Set 和List:Collections是 ...