---
title: "ruby中的单元测试"
author: "sg552"
date: "2012-08-04T09:05:28Z"
tags: []
categories: ["编程语言"]
slug: "ruby"
draft: false
lastmod: "2012-08-04T09:05:28Z"
id: 1618707
url: "https://sg552.iteye.com/blog/1618707"
---

单元测试中的几个术语：
double:  the generic term for any kind of pretend object used in place of areal object for testing purpose. 是一种通用的称呼，来指： 所有用于替换真实对象的组建。

Dummy: 空对象，啥都不做。仅仅用于某些parameter的占位（ fill parameter lists) 

Fake : 能用，但是不适合生产环境，例如：  in memory database. 

Stubs:  对某个方法的模拟调用，它返回的值是被我们预先设定的。

Mocks:  某个模拟用的对象，替换真实存在的对象。



参考：  <martinfowler.com/articles/mocksArentStubs.html>