曾小乱

Hello world of mocha.js(测试相关)

曾小乱 | 2019年10月28日 | 324 views

缘起

1、业务场景不适用

2、填补知识的空白

Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun.

mocha(摩卡)

// a type of coffee of very good quality.

目录

Why🦌、How🔨、Something else😁

Why🦌

  1. 不出 bug
  2. 一种设计思路
  3. 方便重构

TDD

// Test Driven Development

TDD is an innovative software development approach where tests are written, before writing the bare minimum of code required for the test to be fulfilled. The code will then be refactored, as often as necessary, in order to pass the test, with the process being repeated for each piece of functionality. 

1、Write test
2、Run test
3、Check for failed tests
4、Make changes to the code
5、Repeat from step 2

BDD( Behavior-Driven Development )

BDD是第二代的、由外及内的、基于拉(pull)的、多方利益相关者的(stakeholder)、多种可扩展的、高自动化的敏捷方法。它描述了一个交互循环,可以具有带有良好定义的输出(即工作中交付的结果):已测试过的软件。

Dan North (维基百科)
BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.

Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework.

How🔨

See the Pen mocha-first-day by zeng (@zengxiaoluan) on CodePen.

More: 集成测试(Big Bang、自顶向下、自底向上)、系统测试、验收测试、e2e、黑盒测试、、、还有很多列不下去了

2020 新年快乐!😺

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据