博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Discover a powerful and suitable Javascript Automatic Testing Toolkit
阅读量:6892 次
发布时间:2019-06-27

本文共 2015 字,大约阅读时间需要 6 分钟。

 

Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

Discover a powerful and suitable

Javascript Automatic Testing Toolkit

by Daniel Yang

Purpose

Find out the best Javascript testing library for us.

QUnit vs Jasmine

  • support in brower & Node.js
  • testing of DOM manipulation
  • TDD or BDD

BDD or TDD

in Jasemine

expect(5).toEqual(5);

expect(5).not.toEqual(5);

in Qunit

strictEqual(5, 5);

notStrictEqual(5, 5);

But we need something more...

  • how to test in different browers
  • how to test with a AMD loader
  • and how to automatic testing

JsTestDriver + Jasmine

This is the Taobao's solutions in used, but it has some bugs which make people get fighting mad.

Pro

  • testing in different browers
  • automatic testing
  • BDD style script

Con

  • asynchronous support is not good, and you shall mock up the data when using AJAX.
  • couldn't support all Jasmine method
  • and it built in Java(not JS)

Is there any libaray

can solve these problems?

My answer is Buster.js

Easy to deploy

use npm to install & manager

npm install -g buster

npm install buster-amd

Browser Testing

Buster.JS can automate browsers, JsTestDriver style.

buster server

Buster.JS also has a static browser runner that runs tests by opening a web page in a browser. This is similar to QUnit, Mocha, etc.

buster static

AJAX Testing

using Sinon.JS to mock out the entire XHR stack in a browser, so we can test AJAX easily.

Asynchronous tests

To tag a test as async, have the test function take one argument, done.

The done argument is a function. Call it to tell Buster.JS that the asynchronous test has finished running.

Test reporters

Buster.JS can create all human-consumable reports(by Terminal, JSON, XML and HTML).

Buster.JS is still beta, so it has some rough edges.

But I think this solutions will satisfy our needs.

Thanks for your watching!

 

转载于:https://www.cnblogs.com/justany/archive/2013/04/06/3002859.html

你可能感兴趣的文章
PAT (Advanced Level) 1107. Social Clusters (30)
查看>>
【开源社群系统研发日记五】ThinkSNS+ 是如何计算字符显示长度的
查看>>
Nodejs日志管理log4js
查看>>
python获取昨日日期
查看>>
海康威视 - 萤石云开放平台 js 版
查看>>
关于分销平台
查看>>
jquery实用的一些方法
查看>>
质数方阵
查看>>
jQuery $.each用法
查看>>
C语言结构体指针成员强制类型转换
查看>>
基于域的无线安全认证方案
查看>>
Thread类常用方法
查看>>
几乎所有编程语言的hello, world程序(3)
查看>>
CentOs 设置静态IP 方法
查看>>
Nginx内置变量以及日志格式变量参数详解
查看>>
Docker 命令
查看>>
如何在andorid native layer中加log function.【转】
查看>>
杂七杂八的文档资料。
查看>>
C#.NET 大型企业信息化系统集成快速开发平台 4.2 版本 - 访问频率限制功能实现、防止黑客扫描、防止恶意刷屏...
查看>>
如何在Hyper-V虚拟中安装Hyper-V角色
查看>>