自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Magicpang

Tracking the Road

  • 博客(96)
  • 资源 (16)
  • 收藏
  • 关注

原创 mgo 连接需要授权登录的mongodb

golang mgo authentication

2016-09-29 17:35:28 5884

转载 用ctags自定义的生成规则, 自己生成了lua文件的tags

ctags 生成lua跳转tag方法。

2016-08-22 15:05:54 2160

原创 保存一份VIM配置

使用的插件  NERDTree A.vim Taglist NERDCommentset nocompatibleset nuset backspace=indent,eol,startset ts=2set shiftwidth=2set etset aiset autoreadset cmdheight=2set showmatchset h

2016-08-15 00:45:29 1243

转载 低版本python如何安装 pip

Python 2.7.9+ and 3.4+Good news! Python 3.4 (released March 2014) and Python 2.7.9 (released December 2014) ship with Pip. This is the best feature of any Python release. It makes the community'

2016-08-12 10:13:27 1987

原创 自定义sublime的快捷键

我把mbp上面的ctrl改成了meta所以windows下面要稍微改写下,不然按键比较怪这个是用于windows上面的,[{ "keys": ["alt+l"], "command": "svn_log" },{ "keys": ["alt+d"], "command": "svn_diff" },{ "keys": ["ctrl+a"], "command": "move_t

2016-05-31 10:13:40 447

原创 lua中尽量使用local

结论: lua 5.1.5 windows环境下 使用local变量能够稍微提高效率但是如果有了间接引用,比如 上面代码里面 local g = {} 定义成 local a = {}, a.g = {}增加了简介引用之后,效率就会发生变化了实际使用中不是很好控制比如通常一个lua文件通常写成 local a = {} --或者 local a = class(

2016-04-26 10:58:05 13152

转载 2D OBB Intersection

http://www.flipcode.com/archives/2D_OBB_Intersection.shtml--------------------------------------------------------------------2D OBB IntersectionFor 2D graphics or movement of 3D objects on a 2D

2016-04-14 17:36:30 668

转载 Cocos2.2.6创建项目cd tools/project-creator/

http://blog.csdn.net/a542214712/article/details/20638477cd tools/project-creator/./create_project.py ./create_project.py -project hicoco -package net.ataworld.game -language cpp

2016-04-12 23:22:13 432

原创 Texture packer命令行加密

@echo offtexturepacker fishjoy_kind/*.png --data FishJoyKind.plist --sheet FishJoyKind.pvr.ccz --format cocos2d --texture-format pvr2ccz --content-protection ADEFB88CA0D7DE87EE82A3CD9B3FECDF --opt RGB

2016-04-06 15:39:06 918

转载 记录有用的开源库

一些开源库记录下Lua 的https://github.com/kingluo/luajit.io  Pure Lua IO framework, with C efficiency due to its simple but powerful design, and, of course, thanks to luajit, the perfect JIT engine.

2016-03-24 18:45:40 351

转载 利用NDK崩溃日志查找BUG

摘要: 在android上开发c++应用, crash日志都是汇编码, 很难对应到c++代码中去. 通过此文, 你可以定位到程序崩溃时的C++代码, 精确查找问题.博客: http://www.cnblogs.com/jhzhu邮箱: [email protected]作者: 知明所以时间: 2014-06-20背景介绍本文主要内容: 利用android

2016-02-26 11:10:36 680

转载 C++返回table给lua

//定义函数(返回table)int func_return_table(lua_State *L){ lua_newtable(L);//创建一个表格,放在栈顶 lua_pushstring(L, "mydata");//压入key lua_pushnumber(L,66);//压入value lua_settable(L,-3);//弹出key,value,并设置到table里面

2016-02-26 10:47:33 2381

原创 阅读lmathlib.c

1. 重要的结构 luaL_Regtypedef struct luaL_Reg { const char *name; lua_CFunction func;} luaL_Reg;typedef int (*lua_CFunction) (lua_State *L);可以用该结构做参数简单的来创建tableluaL_newlib(L, mathlib);这样在栈顶创

2016-02-17 19:30:01 724

转载 Lua upvalue

Another word for an upvalue in Lua is an external local variable. When you write a new function in Lua, it can access any of the local variables that have the same scope as it. That function 'clos

2016-02-17 18:56:22 574

翻译 苹果拒信2

2.2 - Apps that exhibit bugs will be rejected17.1 - Apps cannot transmit data about a user without obtaining the user's prior permission and providing the user with access to information about how a

2016-02-17 14:12:50 1581

转载 “Operation could not be completed. (SKErrorDomain error 0.)”

http://stackoverflow.com/questions/6664778/error-domain-skerrordomain-code-0-operation-could-not-be-completed-skerrordomYou must logout from your iTunes account in the settings app. Then try aga

2015-12-21 16:07:32 1399

转载 动画

bool GameMain::init(){ if( !Layer::init()) return false; Size visibleSize = CCDirector::sharedDirector()->getVisibleSize(); bg = Sprite::create("battle.png"); bg->setPosition(

2015-12-15 13:49:15 462

转载 苹果的拒信

3.6 - Apps with App icons, screenshots, previews, and images displayed when an Apple TV app is in the top shelf of the Apple TV home screen that do not adhere to the 4+ age rating will be rejected11

2015-12-01 15:47:44 5919

转载 IOS github一些开源库

keychainhttps://github.com/ldandersen/STUtilsIAPhttp://github.com/mugunthkumar/MKStoreKit

2015-11-27 18:17:38 391

转载 cocos2dx 画包围盒

cocos2dx 画包围盒virtual void draw(Renderer *renderer, const Mat4& transform, uint32_t flags);DrawNode* m_pDrawNode = nullptr; m_pDrawNode->clear(); m_pDrawNode->drawLine(Vec2(box.x

2015-11-25 12:40:44 1852

转载 Eclipse hangs at the Android SDK Content Loader

http://stackoverflow.com/questions/13489141/eclipse-hangs-at-the-android-sdk-content-loaderI've been working with Eclipse 4.2 (Juno release 20120920-0800) on OS X 10.8.2 for a few weeks now,

2015-11-24 17:17:03 434

转载 cocos2dx 3.6 webview背景透明(ios android)

cocos2dx 3.6 webview背景透明(ios android)

2015-11-24 16:09:37 4075

转载 Xcode7 *** does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_

http://www.cnblogs.com/zhangyang17/p/4818466.html*** does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, o

2015-11-13 15:05:55 3155 2

转载 苹果产品

http://www.ipadown.com/ http://topapp.net/ http://www.appolicious.com/ http://mobile.butterscotch.com/Mobile/IPhone/ http://wwdc.slidetoplay.com/ http://www.py.iphone-app-lists.com/ http:/

2015-11-12 17:45:01 403

转载 iOS7: 如何获取不变的UDID

http://www.cnblogs.com/smileEvday/p/UDID.html如何使用KeyChain保存和获取UDID   本文是iOS7系列文章第一篇文章,主要介绍使用KeyChain保存和获取APP数据,解决iOS7上获取不变UDID的问题。并给出一个获取UDID的工具类,使用方便,只需要替换两个地方即可。 一、iOS不用版本获取U

2015-11-12 17:07:44 990

转载 IAP 的问题汇总

https://github.com/MugunthKumar/MKStoreKithttps://github.com/sckor/AnystoneStoreKit

2015-11-06 15:23:36 387

翻译 苹果开发的一些要求(汇总到这里)

iPad Pro Screenshots Now SupportedYou can now upload screenshots that are optimized for the iPad Pro. Screenshots for iPad Pro must be 2732 x 2048 pixels or 2048 x 2732 pixels in the JPG or PNG form

2015-11-06 14:50:00 423

转载 iOS9 HTTP 不能正常使用的解决办法

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.解决办法1使用HTTPS解决办法2:在Info.plist中添加NSAppTransportSecurity类型Dictionary。在NSA

2015-11-05 09:54:34 1290

翻译 记录有用的技术博客或网站

苹果开发http://www.raywenderlich.com/

2015-10-06 11:02:47 390

转载 LUA XMLHttpRequest 中有个bug

http://www.cocoachina.com/bbs/read.php?tid-200293-page-e-fpage-20.htmlPS 3.6里面这个问题依然存在LUA XMLHttpRequest 中有个bug   cocos2d-x 3.0 ,源码文件frameworks\cocos2d-x\cocos\scriptin

2015-08-11 11:35:10 2404

转载 删除所有.svn目录

删除所有.svn目录http://blog.csdn.net/xenron/article/details/5707159当使用了svn版本控制系统后每个目录下都会有一个.svn目录存在,开发完当交付产品或者上传到服务器时一般要把这些目录删除,这里总结了一下在linux和win下的办法。 一、在linux下删除这些目录是很简单的,命令如下 find .

2015-07-09 09:26:34 441

转载 android编译系统的makefile文件Android.mk写法

http://www.cnblogs.com/hesiming/archive/2011/03/15/1984444.htmlandroid编译系统的makefile文件Android.mk写法如下(1)Android.mk文件首先需要指定LOCAL_PATH变量,用于查找源文件。由于一般情况下Android.mk和需要编译的源文件在同一目录下,所以定义成如下形式:LOCA

2015-06-12 11:47:03 294

转载 C# 取得本机进程启动命令行参数

using System.Management; private void WmiTest(){using (ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process WHERE Proces

2014-11-06 15:29:49 3344

转载 C#检测进程运行状态

class Program    {        static void Main(string[] args)        {            Process[] processes = Process.GetProcesses();            foreach (Process process in processes)           

2014-10-27 10:10:43 12245

原创 记录下stl vector不能乱用,注意

能一眼看出问题所在吗?#pragma pack(push)#pragma pack(1)struct test{public:test(): name(0) {}~test() {delete [] name;}int a;int aLen;char* name;};#pragma pack(pop)#define

2013-07-11 11:20:28 784

转载 ole date time 转换 tip 2209161600

1970-01-01 00:00=2209161600 1970-01-01 08:00=2209190400 HMS   =   #2007-03-16 21:23# Text1   =   HMS   *   24   *   3600-2209161600

2013-05-28 10:58:31 969

转载 编译期递归的一个例子

fromhttp://stackoverflow.com/questions/4568645/printing-1-to-1000-without-loop-or-conditionals#include templatestruct NumberGeneration{ static void out(std::ostream& os) { NumberGenerat

2012-03-08 20:58:36 552

原创 关于Impl idiom

个人理解c++中头文件这种东西在项目大到一定规模以后,就是罪恶了。随便更改头文件里面某个class的private成员/函数,都会导致依赖文件的rebuild,编译时间增长Impl便是现在能够想到的,解决这个问题的方法 比如class a{    //.... public functionsprivate:    funca();    funcb()

2010-05-14 13:06:00 1555

转载 VIM mass delete words based on spell

from vim user group ++++++++++++++++++++++++++++++++++++++++++++++++++++++I have a long list of words, on word per line. Many of the words arenot "words", i.e. not in a dictionary.I would like t

2010-03-04 21:24:00 807

原创 vim不能正确显示中文

这个问题可谓是老生常谈了,google下或者是百度下,都可以找到很多的答案。我自己的配置文件在我工作环境下面(中文字体好像只有两三种),中文字显示成为了框框。查看配置文件fileencodingsfileencodingtermencoding都已经设好并且,在vim中ggvG然后到notepad中c-v,notepad中能够显示。 搞了一会,发现搞不定,这时候大虾

2010-02-20 13:42:00 5371 3

cjson so linux

cjson so linux all by hand 3

2015-06-09

lua模块cjsondll

找了好久没有找到cjson在windows下的dll,所以自己编了一个,算是一个备份吧。

2015-06-09

C.Plus.Plus.Template.Metaprogramming.

Copyright The C++ In-Depth Series Titles in the Series Preface Acknowledgments Dave's Acknowledgments Aleksey's Acknowledgments Making the Most of This Book Supplementary Material Trying It Out Chapter 1. Introduction Section 1.1. Getting Started Section 1.2. So What's a Metaprogram? Section 1.3. Metaprogramming in the Host Language Section 1.4. Metaprogramming in C++ Section 1.5. Why Metaprogramming? Section 1.6. When Metaprogramming? Section 1.7. Why a Metaprogramming Library? Chapter 2. Traits and Type Manipulation Section 2.1. Type Associations Section 2.2. Metafunctions Section 2.3. Numerical Metafunctions Section 2.4. Making Choices at Compile Time Section 2.5. A Brief Tour of the Boost Type Traits Library Section 2.6. Nullary Metafunctions Section 2.7. Metafunction Definition Section 2.8. History Section 2.9. Details Section 2.10. Exercises Chapter 3. A Deeper Look at Metafunctions Section 3.1. Dimensional Analysis Section 3.2. Higher-Order Metafunctions Section 3.3. Handling Placeholders Section 3.4. More Lambda Capabilities Section 3.5. Lambda Details Section 3.6. Details Section 3.7. Exercises Chapter 4. Integral Type Wrappers and Operations Section 4.1. Boolean Wrappers and Operations Section 4.2. Integer Wrappers and Operations Section 4.3. Exercises Chapter 5. Sequences and Iterators Section 5.1. Concepts Section 5.2. Sequences and Algorithms Section 5.3. Iterators Section 5.4. Iterator Concepts Section 5.5. Sequence Concepts Section 5.6. Sequence Equality Section 5.7. Intrinsic Sequence Operations Section 5.8. Sequence Classes Section 5.9. Integral Sequence Wrappers Section 5.10. Sequence Derivation Section 5.11. Writing Your Own Sequence Section 5.12. Details Section 5.13. Exercises Chapter 6. Algorithms Section 6.1. Algorithms, Idioms, Reuse, and Abstraction Section 6.2. Algorithms in the MPL Section 6.3. Inserters Section 6.4. Fundamental Sequence Algorithms Section 6.5. Querying Algorithms Section 6.6. Sequence Building Algorithms Section 6.7. Writing Your Own Algorithms Section 6.8. Details Section 6.9. Exercises Chapter 7. Views and Iterator Adaptors Section 7.1. A Few Examples Section 7.2. View Concept Section 7.3. Iterator Adaptors Section 7.4. Writing Your Own View Section 7.5. History Section 7.6. Exercises Chapter 8. Diagnostics Section 8.1. Debugging the Error Novel Section 8.2. Using Tools for Diagnostic Analysis Section 8.3. Intentional Diagnostic Generation Section 8.4. History Section 8.5. Details Section 8.6. Exercises Chapter 9. Crossing the Compile-Time/Runtime Boundary Section 9.1. for_each Section 9.2. Implementation Selection Section 9.3. Object Generators Section 9.4. Structure Selection Section 9.5. Class Composition Section 9.6. (Member) Function Pointers as Template Arguments Section 9.7. Type Erasure Section 9.8. The Curiously Recurring Template Pattern Section 9.9. Explicitly Managing the Overload Set Section 9.10. The "sizeof Trick" Section 9.11. Summary Section 9.12. Exercises Chapter 10. Domain-Specific Embedded Languages Section 10.1. A Little Language ... Section 10.2. ... Goes a Long Way Section 10.3. DSLs, Inside Out Section 10.4. C++ as the Host Language Section 10.5. Blitz++ and Expression Templates Section 10.6. General-Purpose DSELs Section 10.7. The Boost Spirit Library Section 10.8. Summary Section 10.9. Exercises Chapter 11. A DSEL Design Walkthrough Section 11.1. Finite State Machines Section 11.2. Framework Design Goals Section 11.3. Framework Interface Basics Section 11.4. Choosing a DSL Section 11.5. Implementation Section 11.6. Analysis Section 11.7. Language Directions Section 11.8. Exercises Appendix A. An Introduction to Preprocessor Metaprogramming Section A.1. Motivation Section A.2. Fundamental Abstractions of the Preprocessor Section A.3. Preprocessor Library Structure Section A.4. Preprocessor Library Abstractions Section A.5. Exercise Appendix B. The typename and template Keywords Section B.1. The Issue Section B.2. The Rules Appendix C. Compile-Time Performance Section C.1. The Computational Model Section C.2. Managing Compilation Time Section C.3. The Tests Appendix D. MPL Portability Summary CD-ROM Warranty Bibliography

2012-06-18

advanced programming in unix env中文版

advanced programming in unix env 中文

2009-11-03

o'reilly - perl testing - a developer's notebook (2006).chm

< Day Day Up > Perl Testing: A Developer's Notebook By chromatic , Ian Langworth ............................................... Publisher: O'Reilly Pub Date: July 2005 ISBN: 0-596-10092-2 Pages: 208 Table of Contents | Index | Errata -------------------------------------------------------------------------------- Copyright The Developer's Notebook Series Notebooks Are... Notebooks Aren't... Organization Preface What This Book Covers Conventions Used in This Book Using Code Examples Safari Enabled Comments and Questions Acknowledgments Chapter 1. Beginning Testing Installing Test Modules Running Tests Interpreting Test Results Writing Your First Test Loading Modules Improving Test Comparisons Chapter 2. Writing Tests Skipping Tests Skipping All Tests Marking Tests as TODO Simple Data Structure Equality Data Composition Testing Warnings Testing Exceptions Chapter 3. Managing Tests Organizing Tests Checking Your Coverage Writing a Testing Library Testing a Testing Library Writing a Testing Harness Testing Across the Network Automating Test Runs Chapter 4. Distributing Your Tests (and Code) Testing POD Files Testing Documentation Coverage Distribution Signatures Testing Entire Distributions Letting the User Decide Letting the User Decide (Continued) Bundling Tests with Modules Collecting Test Results Validating Kwalitee Chapter 5. Testing Untestable Code Overriding Built-ins Mocking Modules Mocking Objects Partially Mocking Objects Overriding Live Code Overriding Operators Everywhere Chapter 6. Testing Databases Shipping Test Databases Testing Database Data Using Temporary Databases Mocking Databases Chapter 7. Testing Web Sites Testing Your Backend Testing Your Frontend Record and Play Back Browsing Sessions Testing the Validity of HTML Running Your Own Apache Server Testing with Apache-Test Distributing Modules with Apache-Test Chapter 8. Unit Testing with Test::Class Writing Test Cases Creating Test Fixtures Inheriting Tests Skipping Tests with Test::Class Marking Tests as TODO with Test::Class Chapter 9. Testing Everything Else Writing Testable Programs Testing Programs Testing Interactive Programs Testing Shared Libraries Colophon About the Authors Colophon Index < Day Day Up >

2009-04-14

Addison.Wesley.xUnit.Test.Patterns.Refactoring.Test.Code.May.2007.pdf

Contents Visual Summary of the Pattern Language . . . . . . . . . . . . . . . . . . . xvii Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix Refactoring a Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xlv PART I. The Narratives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1. A Brief Tour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 The Simplest Test Automation Strategy That Could Possibly Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Development Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Customer Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Unit Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Design for Testability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Test Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Chapter 2. Test Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 An Introduction to Test Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 What’s a Test Smell? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Kinds of Test Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 What to Do about Smells? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 A Catalog of Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 The Project Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 The Behavior Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 The Code Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 viiChapter 3. Goals of Test Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Why Test? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Economics of Test Automation . . . . . . . . . . . . . . . . . . . . . . . . . 20 Goals of Test Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Tests Should Help Us Improve Quality . . . . . . . . . . . . . . . . . . . 22 Tests Should Help Us Understand the SUT . . . . . . . . . . . . . . . . . 23 Tests Should Reduce (and Not Introduce) Risk . . . . . . . . . . . . . 23 Tests Should Be Easy to Run . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Tests Should Be Easy to Write and Maintain . . . . . . . . . . . . . . . 27 Tests Should Require Minimal Maintenance as the System Evolves Around Them . . . . . . . . . . . . . . . . . . . . . . . 29 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Chapter 4. Philosophy of Test Automation . . . . . . . . . . . . . . . . . . . . . . . . . 31 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Why Is Philosophy Important? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Some Philosophical Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Test First or Last? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Tests or Examples? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Test-by-Test or Test All-at-Once? . . . . . . . . . . . . . . . . . . . . . . . . 33 Outside-In or Inside-Out? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 State or Behavior Verifi cation? . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Fixture Design Upfront or Test-by-Test? . . . . . . . . . . . . . . . . . . 36 When Philosophies Differ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 My Philosophy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Chapter 5. Principles of Test Automation . . . . . . . . . . . . . . . . . . . . . . . . . . 39 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 The Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Chapter 6. Test Automation Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 What’s Strategic? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Which Kinds of Tests Should We Automate? . . . . . . . . . . . . . . . . . 50 Per-Functionality Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Cross-Functional Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Contents viiiWhich Tools Do We Use to Automate Which Tests? . . . . . . . . . . . . 53 Test Automation Ways and Means . . . . . . . . . . . . . . . . . . . . . . . 54 Introducing xUnit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 The xUnit Sweet Spot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Which Test Fixture Strategy Do We Use? . . . . . . . . . . . . . . . . . . . . 58 What Is a Fixture? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Major Fixture Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Transient Fresh Fixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Persistent Fresh Fixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Shared Fixture Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 How Do We Ensure Testability? . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Test Last—at Your Peril . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Design for Testability—Upfront . . . . . . . . . . . . . . . . . . . . . . . . . 65 Test-Driven Testability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Control Points and Observation Points . . . . . . . . . . . . . . . . . . . 66 Interaction Styles and Testability Patterns . . . . . . . . . . . . . . . . . 67 Divide and Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Chapter 7. xUnit Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 An Introduction to xUnit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Common Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 The Bare Minimum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Defi ning Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 What’s a Fixture? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Defi ning Suites of Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Running Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Test Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Under the xUnit Covers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Test Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Test Suite Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 xUnit in the Procedural World . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Contents ixChapter 8. Transient Fixture Management . . . . . . . . . . . . . . . . . . . . . . . . . 85 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Test Fixture Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 What Is a Fixture? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 What Is a Fresh Fixture? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 What Is a Transient Fresh Fixture? . . . . . . . . . . . . . . . . . . . . . . . 87 Building Fresh Fixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 In-line Fixture Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Delegated Fixture Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Implicit Fixture Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Hybrid Fixture Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Tearing Down Transient Fresh Fixtures . . . . . . . . . . . . . . . . . . . . . 93 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Chapter 9. Persistent Fixture Management . . . . . . . . . . . . . . . . . . . . . . . . . .95 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Managing Persistent Fresh Fixtures . . . . . . . . . . . . . . . . . . . . . . . . 95 What Makes Fixtures Persistent? . . . . . . . . . . . . . . . . . . . . . . . . 95 Issues Caused by Persistent Fresh Fixtures . . . . . . . . . . . . . . . . . 96 Tearing Down Persistent Fresh Fixtures . . . . . . . . . . . . . . . . . . . 97 Avoiding the Need for Teardown . . . . . . . . . . . . . . . . . . . . . . . 100 Dealing with Slow Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Managing Shared Fixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Accessing Shared Fixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Triggering Shared Fixture Construction . . . . . . . . . . . . . . . . . . 104 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Chapter 10. Result Verifi cation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Making Tests Self-Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Verify State or Behavior? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 State Verifi cation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Using Built-in Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Delta Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 External Result Verifi cation . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Verifying Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Procedural Behavior Verifi cation . . . . . . . . . . . . . . . . . . . . . . . 113 Expected Behavior Specifi cation . . . . . . . . . . . . . . . . . . . . . . . . 113 Contents xReducing Test Code Duplication . . . . . . . . . . . . . . . . . . . . . . . . . 114 Expected Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Custom Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Outcome-Describing Verifi cation Method . . . . . . . . . . . . . . . . 117 Parameterized and Data-Driven Tests . . . . . . . . . . . . . . . . . . . 118 Avoiding Conditional Test Logic . . . . . . . . . . . . . . . . . . . . . . . . . 119 Eliminating “if” Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Eliminating Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Other Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Working Backward, Outside-In . . . . . . . . . . . . . . . . . . . . . . . . 121 Using Test-Driven Development to Write Test Utility Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Where to Put Reusable Verifi cation Logic? . . . . . . . . . . . . . . . . . . 122 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Chapter 11. Using Test Doubles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 What Are Indirect Inputs and Outputs? . . . . . . . . . . . . . . . . . . . . 125 Why Do We Care about Indirect Inputs? . . . . . . . . . . . . . . . . . 126 Why Do We Care about Indirect Outputs? . . . . . . . . . . . . . . . 126 How Do We Control Indirect Inputs? . . . . . . . . . . . . . . . . . . . 128 How Do We Verify Indirect Outputs? . . . . . . . . . . . . . . . . . . . 130 Testing with Doubles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Types of Test Doubles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Providing the Test Double . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Confi guring the Test Double . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Installing the Test Double . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Other Uses of Test Doubles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Endoscopic Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Need-Driven Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Speeding Up Fixture Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Speeding Up Test Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Other Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Chapter 12. Organizing Our Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Basic xUnit Mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Contents xiRight-Sizing Test Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Test Methods and Testcase Classes . . . . . . . . . . . . . . . . . . . . . . . . 155 Testcase Class per Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Testcase Class per Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Testcase Class per Fixture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Choosing a Test Method Organization Strategy . . . . . . . . . . . . 158 Test Naming Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 Organizing Test Suites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Running Groups of Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Running a Single Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Test Code Reuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 Test Utility Method Locations . . . . . . . . . . . . . . . . . . . . . . . . . 163 TestCase Inheritance and Reuse . . . . . . . . . . . . . . . . . . . . . . . . 163 Test File Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Built-in Self-Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Test Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Test Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Chapter 13. Testing with Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Testing with Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Why Test with Databases? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Issues with Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Testing without Databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Testing the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Testing Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Testing the Data Access Layer . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Ensuring Developer Independence. . . . . . . . . . . . . . . . . . . . . . . 173 Testing with Databases (Again!) . . . . . . . . . . . . . . . . . . . . . . . . . . 173 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 Chapter 14. A Roadmap to Effective Test Automation . . . . . . . . . . . . . . . 175 About This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Test Automation Diffi culty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Roadmap to Highly Maintainable Automated Tests . . . . . . . . . . . 176 Exercise the Happy Path Code . . . . . . . . . . . . . . . . . . . . . . . . . 177 Verify Direct Outputs of the Happy Path . . . . . . . . . . . . . . . . . 178 Contents xiiVerify Alternative Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Verify Indirect Output Behavior . . . . . . . . . . . . . . . . . . . . . . . . 179 Optimize Test Execution and Maintenance . . . . . . . . . . . . . . . 180 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 PART II. The Test Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 Chapter 15. Code Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 Obscure Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Conditional Test Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Hard-to-Test Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Test Code Duplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Test Logic in Production . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Chapter 16. Behavior Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Assertion Roulette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Erratic Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Fragile Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Frequent Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 Manual Intervention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Slow Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 Chapter 17. Project Smells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Buggy Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Developers Not Writing Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 High Test Maintenance Cost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Production Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 PART III. The Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 Chapter 18. Test Strategy Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 Recorded Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Scripted Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Data-Driven Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 Test Automation Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 Minimal Fixture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 Standard Fixture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 Fresh Fixture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 Contents xiiiShared Fixture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Back Door Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 Layer Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Chapter 19. xUnit Basics Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 Test Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 Four-Phase Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 Assertion Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 Assertion Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 Testcase Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 Test Runner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 Testcase Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 Test Suite Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 Test Discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 Test Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 Test Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 Chapter 20. Fixture Setup Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 In-line Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 Delegated Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 Creation Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 Implicit Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 Prebuilt Fixture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 Lazy Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 Suite Fixture Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441 Setup Decorator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 Chained Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 Chapter 21. Result Verifi cation Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . 461 State Verifi cation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 Behavior Verifi cation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 Custom Assertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 Delta Assertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 Guard Assertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Unfi nished Test Assertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 Chapter 22. Fixture Teardown Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . 499 Garbage-Collected Teardown . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 Contents xivAutomated Teardown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503 In-line Teardown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 Implicit Teardown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516 Chapter 23. Test Double Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 Test Double . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 Test Stub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 Test Spy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538 Mock Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544 Fake Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551 Confi gurable Test Double . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558 Hard-Coded Test Double . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 Test-Specifi c Subclass. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579 Chapter 24. Test Organization Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . 591 Named Test Suite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 Test Utility Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599 Parameterized Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 Testcase Class per Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617 Testcase Class per Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 Testcase Class per Fixture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 Testcase Superclass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638 Test Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643 Chapter 25. Database Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649 Database Sandbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650 Stored Procedure Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654 Table Truncation Teardown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661 Transaction Rollback Teardown . . . . . . . . . . . . . . . . . . . . . . . . . . 668 Chapter 26. Design-for-Testability Patterns . . . . . . . . . . . . . . . . . . . . . . . . 677 Dependency Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 Dependency Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686 Humble Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 Test Hook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709 Chapter 27. Value Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 Literal Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 Contents xvDerived Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 Generated Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 Dummy Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 PART IV. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 Appendix A. Test Refactorings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 Appendix B. xUnit Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741 Appendix C. xUnit Family Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747 Appendix D. Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753 Appendix E. Goals and Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757 Appendix F. Smells, Aliases, and Causes . . . . . . . . . . . . . . . . . . . . . . . . . . 761 Appendix G. Patterns, Aliases, and Variations . . . . . . . . . . . . . . . . . . . . . . 767 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835 Visual Summary of the Pattern Language xvi

2009-04-04

计算机程序艺术 英文版 第三卷 part5

计算机程序艺术 英文版 第三卷 part5

2009-03-14

计算机程序艺术 英文版 第三卷 part4

计算机程序艺术 英文版 第三卷 part4

2009-03-14

计算机程序艺术 英文版 第三卷 part3

计算机程序艺术 英文版 第三卷 共五个压缩包, 这个是第三个

2009-03-08

计算机程序艺术 英文版 第三卷 part2

计算机程序艺术 英文版 第三卷 共五个压缩包, 这个是第二个

2009-03-02

计算机程序艺术第三卷

计算机程序艺术 英文版,第三卷,共5个压缩包,这是第一个

2009-02-27

Understanding and Writing Compilers

A do-it-yourself guide 自己写一个编译器

2009-02-24

Compilers:Principles, Techniques, and Tools

Compilers:Principles, Techniques, and Tools第二版,总共两个分包,这是第一个

2008-10-05

Compilers:Principles, Techniques, and Tools

Compilers:Principles, Techniques, and Tools 第二版,总共两个分包,这是第二部分

2008-10-05

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除