{{sellerTotalView > 1 ? __("sellers", {number: sellerTotalView}) : __("seller", {number: sellerTotalView}) }}, {{numTotalView > 1 ? __("items", {number: numTotalView}) : __("item", {number: numTotalView}) }}
free FREE

Change Your Zip Code

Inventory information and delivery speeds may vary for different locations.

Location History

{{email ? __('Got it!') : __('Restock Alert')}}

We will notify you by email when the item back in stock.

Cancel
Yami

Jingdong book

有效的单元测试

{{buttonTypePin == 3 ? __("Scan to view more PinGo") : __("Scan to start")}}

有效的单元测试

{{__(":people-members", {'people': item.limit_people_count})}} {{ itemCurrency }}{{ item.valid_price }} {{ itemCurrency }}{{ item.invalid_price }} {{ itemDiscount }}
Ends in
{{ itemCurrency }}{{ item.valid_price }}
{{ itemCurrency }}{{ priceFormat(item.valid_price / item.bundle_specification) }}/{{ item.unit }}
{{ itemDiscount }}
{{ itemCurrency }}{{ item.valid_price }} {{ itemCurrency }}{{ priceFormat(item.valid_price / item.bundle_specification) }}/{{ item.unit }} {{ itemCurrency }}{{ item.invalid_price }} {{itemDiscount}}
{{ itemCurrency }}{{ item.valid_price }}
Sale ends in
Sale will starts after Sale ends in
{{ getSeckillDesc(item.seckill_data) }}
{{ __( "Pay with Gift Card to get sale price: :itemCurrency:price", { 'itemCurrency' : itemCurrency, 'price' : (item.giftcard_price ? priceFormat(item.giftcard_price) : '0.00') } ) }} ({{ itemCurrency }}{{ priceFormat(item.giftcard_price / item.bundle_specification) }}/{{ item.unit }}) Details
Best before

Currently unavailable.

We don't know when or if this item will be back in stock.

Unavailable in your area.
Sold Out

Details

Full product details
Editer Recommend

资深敏捷技术实践专家撰写,系统且深入地阐释单元测试用于软件设计的工具、方法、原则和最佳实践。
深入剖析各种测试常见问题,包含大量实践案例,可操作性强,能为用户高效编写优秀测试提供系统实践指南。
Content Description

《有效的单元测试》是一本关于单元测试的专著,由资深敏捷技术实践专家撰写,不仅系统且深入地阐释了单元测试用于软件设计的工具、方法、原则和最佳实践,而且对各种测试常见问题进行了深入分析,包含大量实践案例,可操作性强,能为用户高效编写优秀测试提供有效指导,让组织持续创造成功的产品和服务。
《有效的单元测试》分为三部分,共9章。第一部分(第1~3章)主要阐述测试的目的与原因,并分析作为常用工具的测试替身的作用。第1章先从整体阐释测试先行所带来的价值,以及各种对测试和测试质量的影响。第2章定义如何才能写出优秀的测试。第3章讨论现代程序员最基本的工具之一——测试替身。第二部分(第4~6章)的目标是帮助我们更好地识别并修复测试代码中的坏味道。第4章展示破坏测试可读性的坏味道。第5章继续对破坏可维护性的测试提供建议。第6章涉及有关脆弱或不可靠的测试坏味道。第三部分(第7~9章)涉及Java程序员在编写测试时随时可能碰到的话题。第7章介绍可测的设计的定义与作用。第8章探讨JVM语言的共生,以及如何用另一门语言来测试Java代码。第9章专门讨论对构建进行加速的问题。此外还包括两个附录,附录A介绍使用JUnit编写测试的入门知识。附录B探讨通过JUnit的API来扩展其内置功能。
Author Description

Lasse Koskela,资深敏捷技术实践专家、敏捷教练、培训师、顾问和程序员,具有数十年计算机程序设计和开发经验。他精通多种编程语言,尤其对Java、Ruby、C/C++有独到见解,热衷于编程和追逐前沿技术,在程序设计、软件工程、项目管理等多个领域颇有建树。目前他主攻开源项目,帮助企业提高生产力,而且经常在世界各地的会议上发表演讲。除本书外,他还著有《测试驱动开发的艺术》。
Catalogue

第一部分基础
第1章优秀测试的承诺
1.1国情咨文:编写更好的测试
1.2测试的价值
1.2.1生产力的因素
1.2.2设计潜力的曲线
1.3测试作为设计工具
1.3.1测试驱动开发
1.3.2行为驱动开发
1.4小结
第2章寻求优秀
2.1可读的代码才是可维护的代码
2.2结构有助于理解事物
2.3如果测试了错误的东西就不好了
2.4独立的测试易于单独运行
2.5可靠的测试才是可靠的
2.6每个行业都有其工具而测试也不例外
2.7小结
第3章测试替身
3.1测试替身的威力
3.1.1隔离被测代码
3.1.2加速执行测试
3.1.3使执行变得确定
3.1.4模拟特殊情况
3.1.5暴露隐藏的信息
3.2测试替身的类型
3.2.1测试桩通常是短小的
3.2.2伪造对象做事不产生副作用
3.2.3测试间谍偷取秘密
3.2.4模拟对象反对惊喜
3.3使用测试替身的指南
3.3.1为测试挑选合适的替身
3.3.2准备、执行、断言
3.3.3检查行为,而非实现
3.3.4挑选你的工具
3.3.5注入依赖
3.4小结
第二部分目录
第4章可读性
4.1基本断言
4.1.1示例
4.1.2该对它做点儿什么
4.1.3小结
4.2过度断言
4.2.1示例
4.2.2该对它做点儿什么
4.2.3小结
4.3按位断言
4.3.1示例
4.3.2该对它做点儿什么
4.3.3小结
4.4附加细节
4.4.1示例
4.4.2该对它做点儿什么
4.4.3小结
4.5人格分裂
4.5.1示例
4.5.2该对它做点儿什么
4.5.3小结
4.6逻辑分割
4.6.1示例
4.6.2该对它做点儿什么
4.6.3小结
4.7魔法数字
4.7.1示例
4.7.2该对它做点儿什么
4.7.3小结
4.8冗长安装
4.8.1示例
4.8.2该对它做点儿什么
4.8.3小结
4.9过分保护
4.9.1示例
4.9.2该对它做点儿什么
4.9.3小结
4.10总结
第5章可维护性
5.1重复
5.1.1示例
5.1.2该对它做点儿什么
5.1.3小结
5.2条件逻辑
5.2.1示例
5.2.2该对它做点儿什么
5.2.3小结
5.3脆弱的测试
5.3.1示例
5.3.2该对它做点儿什么
5.3.3小结
5.4残缺的文件路径
5.4.1示例
5.4.2该对它做点儿什么
5.4.3小结
5.5永久的临时文件
5.5.1示例
5.5.2该对它做点儿什么
5.5.3小结
5.6沉睡的蜗牛
5.6.1示例
5.6.2该对它做点儿什么
5.6.3小结
5.7像素完美
5.7.1示例
5.7.2该对它做点儿什么
5.7.3小结
5.8参数化混乱
5.8.1示例
5.8.2该对它做点儿什么
5.8.3小结
5.9方法间缺乏内聚
5.9.1示例
5.9.2该对它做点儿什么
5.9.3小结
5.10总结
第6章可信赖
6.1注释掉的测试
6.1.1示例
6.1.2该对它做点儿什么
6.1.3小结
6.2歧义注释
6.2.1示例
6.2.2该对它做点儿什么
6.2.3小结
6.3永不失败的测试
6.3.1示例
6.3.2该对它做点儿什么
6.3.3小结
6.4轻率承诺
6.4.1示例
6.4.2该对它做点儿什么
6.4.3小结
6.5降低期望
6.5.1示例
6.5.2该对它做点儿什么
6.5.3小结
6.6平台偏见
6.6.1示例
6.6.2该对它做点儿什么
6.6.3小结
6.7有条件的测试
6.7.1示例
6.7.2该对它做点儿什么
6.7.3小结
6.8总结
第三部分消遣
第7章可测的设计
7.1什么是可测的设计
7.1.1模块化设计
7.1.2SOLID设计原则
7.1.3上下文中的模块化设计
7.1.4以测试驱动出模块化设计
7.2可测性的问题
7.2.1无法实例化某个类
7.2.2无法调用某个方法
7.2.3无法观察到输出
7.2.4无法替换某个协作者
7.2.5无法覆盖某个方法
7.3可测的设计的指南
7.3.1避免复杂的私有方法
7.3.2避免final方法
7.3.3避免static方法
7.3.4使用new时要当心
7.3.5避免在构造函数中包含逻辑
7.3.6避免单例
7.3.7组合优于继承
7.3.8封装外部库
7.3.9避免服务查找
7.4小结
第8章用其他JVM语言来编写测试
8.1混合使用JVM语言的前提
8.1.1通用收益
8.1.2编写测试
8.2用Groovy来编写测试
8.2.1简化的测试setup
8.2.2Groovy式的JUnit 4测试
8.3BDD工具的表达力
8.3.1用easyb写Groovy需求说明
8.3.2Spock Framework:编写更具表达力测试的激素
8.3.3Spock Framework的测试替身也打了激素
8.4小结
第9章加速执行测试
9.1追求速度
9.1.1对速度的需要
9.1.2进入状况
9.1.3对构建进行性能分析
9.1.4对测试进行性能分析
9.2令测试代码加速
9.2.1别睡觉,除非你累了
9.2.2当心膨胀的基类
9.2.3当心冗余的setup与teardown
9.2.4挑剔地添加新测试
9.2.5保持本地运行,保持快速
9.2.6抵御访问数据库的诱惑
9.2.7没有比文件I/O更慢的I/O了
9.3令构建加速
9.3.1RAM磁盘带来更快的I/O
9.3.2并行构建
9.3.3改换为高性能CPU
9.3.4分布式构建
9.4小结
附录AJUnit入门
附录B扩展JUnit
Book Abstract

缺陷逃逸数量增多的另一个因素是测试结果的准确度。你若要能够依赖于测试套件去识别引入的错误,那么准确度是一个基本要求。剩下的两个影响生产力的测试相关根本原因,都会直接影响测试准确度,它们叫做可信赖性和可靠性。为了测试报告的准确性,测试需要断言它们的承诺,并以可靠、可重复的方式提供断言。
通过关注对生产力的影响力,你可以扩展质量稳态。使程序员变得高效的关键正是这些已经识别出的根本原因。高产的先决条件是你足够了解你的工具,而不是持续分散你的注意力。一旦你了解了编程语言,你可以浏览其核心API。当你熟悉了问题域,就专注于根本原因——可读性、可靠性、可信赖性和测试的速度。
这也是本书剩余大部分将要围绕的内容——帮助你提高对测试代码可读性、可信赖性和可靠性的意识和感觉,并确保你能持续使用这种工作方式,以确保可维护性。
在那之前,我们来解释图1.2中的第二条曲线。
1.2.2设计潜力的曲线
假设你先写了最重要的测试——针对最常见和基本的场景,以及软件架构中的关键部位。
你的测试质量很高,你大胆地将重复都重构掉,保持测试精益且可维护。现在想象一下,你积累了如此高的测试覆盖率,唯一没测到的地方只是那些直接针对字段的访问器。平心而论,为那些地方写测试没什么价值。因此,之前的做法倾向于收益递减——你已经不能再从“仅仅”编写测试这件事中获取价值了。
这是由于我们不做的事情而造成的质量稳态。之所以这么说是因为想要达到更高的生产力,你需要换个思路去考虑测试。为了找回丢掉的潜力,你需要从编写测试中找到完全不同的价值——价值来自于创新及设计导向,而非防止回归缺陷的保护及验证导向。
总而言之,为了能同时达到两个稳态,从而完全发挥测试的潜力,你需要:
1。像生产代码一样对待你的测试代码——大胆地重构、创建和维护高质量测试,你自己要对它们有信心。
2.开始将测试作为一种设计工具,指导代码针对实际用途进行设计。
如前所述,前者造成了大多数程序员在编写测试时会不知所措,无法顾及高质量,或降低编写、维护、运行测试的成本。这也是本书的重点——编写优秀的测试。
也就是说我们不会花很多时间去讨论利用测试作为设计的方面。我只是想让你对这种动态和工作方式有个全面的了解,那我们详细说说这个话题再前进吧。
1.3测试作为设计工具
传统上,程序员编写的自动化测试被看做是质量保证工作,用于在编写的时候验证实现的正确性,以及将来代码进化的时候验证正确性。这就是将测试作为验证工具——你设想一份设计,编写代码实现,编写测试验证实现是否正确。
使用自动化测试作为设计工具将世界颠倒过来了。当你用测试设计代码时,你将典型的“设计,编码,测试”序列变换为“测试,编码,设计”。是的,就是那样。测试先于编码,并以追溯性的设计活动来得出结论。那结论性的设计活动称为重构,序列变为“测试,编码,重构”.如图1.4所示。
1.3.1测试驱动开发
TDD,如图1.5所示,是一种很有章法的编程技术,它基于一个简单的想法:在编写出能够证明代码存在的失败测试之前,不写生产代码。这也是它有时被称为测试先行编程的原因。
不止这些。先写测试,会向测试所期望的方向来驱动生产代码的设计。这会带来以下令人满意的后果:
·代码变得可用——代码的设计和API适合于你的使用场景。
·代码变得精益——生产代码仅仅实现场景所需要的功能。
首先,无论你工作在系统蓝图的哪一部分,无论其他组件、类或接口存在与否,你一定是在为一个具体的场景来设计解决方案。你将该场景翻译为一个可执行的例子,以自动化单元测试的方式。运行测试,看着它失败,你具有了一个使之通过的清晰目标,只编写足够的生产代码——不要多写。
……

Specifications

Brand Jingdong book
Brand Origin China

Disclaimer

Product packaging, specifications and price are subject to change without notice. All information about the products on our website is provided for information purposes only. Please always read labels, warnings and directions provided with the product before use.

View Full Terms of Use
Add to favorites
{{ $isZh ? coupon.coupon_name_sub : coupon.coupon_ename_sub | formatCurrency }}
{{__("Buy Directly")}} {{ itemCurrency }}{{ item.directly_price }}
Quantity
{{ quantity }}
{{ instockMsg }}
{{ limitText }}
{{buttonTypePin == 3 ? __("Scan to view more PinGo") : __("Scan to start")}}
Sold by JD@CHINA
Ship to
{{ __("Ship to United States only") }}
Free shipping over 69
Genuine guarantee

Added to Cart

Keep Shopping

More to Consider

{{ item.brand_name }}

{{ item.item_name }}

{{ item.currency }}{{ item.market_price }}

{{ item.currency }}{{ item.unit_price }}

{{ item.currency }}{{ item.unit_price }}

Coupons

{{ coupon.coupon_name_new | formatCurrency }}
Clip Clipped Over
{{ getCouponDescStr(coupon) }}
{{ coupon.use_time_desc }}
Expires soon {{ formatTime(coupon.use_end_time) }}

Share this item with friends

Cancel

Yami Gift Card

Get this exclusive deal when paying with gift card

Terms and Conditions

Gift card deals are special offers for selected products;

The gift card deals will automatically be activated if a customer uses gift card balance at check out and the balance is sufficient to pay for the total price of the shopping cart products with gift card deals;

You will not be able to activate the gift card deals if you choose other payment methods besides gift card. The products will be purchased at their normal prices;

If your account balance is not enough to pay for the products with gift card deals, you can choose to reload your gift card balance by clicking on the Reload button at either shopping cart page or check out page;

Products that have gift card deals can be recognized by a special symbol showing 'GC Deal';

For any additional questions or concerns, please contact our customer service;

Yamibuy reserves the right of final interpretation.

Sold by Yami

Service Guarantee

Yami Free Shipping over $49
Yami Easy Returns
Yami Ships from United States

Shipping

  • United States

    Standard Shipping is $5.99 (Excluding Alaska & Hawaii). Free on orders of $49 or more.

    Local Express is $5.99 (Available in Parts of CA, NJ, MA & PA). Free on orders of $49 or more.

    2-Day Express (Includes Alaska & Hawaii) starts at $19.99.

Return Policy

Yami is committed to provide our customers with a peace of mind when purchasing from us. Most items shipped from Yamibuy.com can be returned within 30 days of receipt of shipment (For Food, Beverages, Snacks, Dry Goods, Health supplements, Fresh Grocery and Perishables Goods, within 7 days of receipt of shipment due to damages or quality issues; To ensure that every customer receives safe and high-quality products, we do not provide refunds or returns for beauty products once they have been opened or used, except in the case of quality issues; Some products may have different policies or requirements associated with them, please see below for products under special categories, or contact Yami Customer Service for further assistance).
Thank you for your understanding and support.

Learn More

Sold by Yami

Terms and Conditions of Yami E-Gift Card

If you choose “Redeem automatically” as your delivery method, your gift card balance will be reload automatically after your order has been processed successfully;

If you choose “Send to Email”as your delivery method, the card number and CVV will be sent to the email address automatically;

Any user can use the card number and CVV to redeem the gift card, please keep your gift card information safely. If you have any trouble receiving email, please contact Yami customer service;

Yami gift card can be used to purchase both Yami owned or Marketplace products;

Yami gift card will never expire;

Yami gift card balance does not have to be used up at once;

All rights reserved by Yami.

Return Policy

Gift card that has already been consumed is non-refundable.

Sold by JD@CHINA

Service Guarantee

Yami Free Shipping over $49
Yami Easy Returns
Yami Ships from United States

Shipping

  • United States

    Standard Shipping is $5.99 (Excluding Alaska & Hawaii). Free on orders of $49 or more.

    Local Express is $5.99 (Available in Parts of CA, NJ, MA & PA). Free on orders of $49 or more.

    2-Day Express (Includes Alaska & Hawaii) starts at $19.99.

Return Policy

You may return product within 30 days upon receiving the product. Items returned must be new in it's original packing, including the original invoice for the purchase. Customer return product at their own expense.

Sold by JD@CHINA

Service Guarantee

Yami Cross-store Free Shipping over $69
Yami 30-days Return

Yami-China FC

Yami has a consolidation warehouse in China which collects multiple sellers’ packages and combines to one order. Our Yami consolidation warehouse will directly ship the packages to your door. Cross-store free shipping over $69.

Return Policy

You may return products within 30 days upon receiving the products. Sellers take responsibilities for any wrong shipment or missing items. Packing needs to be unopened for any other than quality issues return. We promise to pack carefully, but because goods are taking long journey to destinations, simple damages to packaging may occur. Any damages not causing internal goods quality problems are not allowed to return. If you open the package and any quality problem is found, please contact customer service within three days after receipt of goods.

Shipping Information

Yami Consolidation Service Shipping Fee $9.99(Free shipping over $69)

Sellers in China will ship their orders within 1-2 business days once the order is placed. Packages are sent to our consolidation warehouse in China and combined there. Our Yami consolidation warehouse will directly ship the packages to you via UPS. The average time for UPS to ship from China to the United States is about 10 working days and it can be traced using the tracking number. Due to the pandemic, the delivery time may be delayed by about 5 days. The package needs to be signed by the guest. If the receipt is not signed, the customer shall bear the risk of loss of the package.

Sold by JD@CHINA

Service Guarantee

Free shipping over 69
Genuine guarantee

Shipping

Yami Consolidated Shipping $9.99(Free shipping over $69)


Seller will ship the orders within 1-2 business days. The logistics time limit is expected to be 7-15 working days. In case of customs clearance, the delivery time will be extended by 3-7 days. The final receipt date is subject to the information of the postal company.

Yami Points information

All items are excluding from any promotion or points events on Yamibuy.com

Return Policy

You may return product within 30 days upon receiving the product. Items returned must be new in it's original packing, including the original invoice for the purchase. Customer return product at their own expense.

Yami

Download the Yami App

Back Top

Recommended for You

About the brand

Jingdong book

为您推荐

Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折

Reviews{{'('+ commentList.posts_count + ')'}}

Have your say. Be the first to help other guests.

Write a review
{{ totalRating }} Write a review
  • {{i}} star

    {{i}} stars

    {{ parseInt(commentRatingList[i]) }}%

Yami Yami
{{ comment.user_name }}

{{ showTranslate(comment) }}Show Less

{{ strLimit(comment,800) }}Show more

Show Original

{{ comment.content }}

Yami
Show All

{{ formatTime(comment.in_dtm) }} VERIFIED PURCHASE {{groupData}}

{{ comment.likes_count }} {{ comment.likes_count }} {{ comment.reply_count }} {{comment.in_user==uid ? __('Delete') : __('Report')}}
Yami Yami
{{ comment.user_name }}

{{ showTranslate(comment) }}Show Less

{{ strLimit(comment,800) }}Show more

Show Original

{{ comment.content }}

Yami
Show All

{{ formatTime(comment.in_dtm) }} VERIFIED PURCHASE {{groupData}}

{{ comment.likes_count }} {{ comment.likes_count }} {{ comment.reply_count }} {{comment.in_user==uid ? __('Delete') : __('Report')}}

No related comment~

Review

Yami Yami

{{ showTranslate(commentDetails) }}Show Less

{{ strLimit(commentDetails,800) }}Show more

Show Original

{{ commentDetails.content }}

Yami
Show All

{{ formatTime(commentDetails.in_dtm) }} VERIFIED PURCHASE {{groupData}}

{{ commentDetails.likes_count }} {{ commentDetails.likes_count }} {{ commentDetails.reply_count }} {{commentDetails.in_user==uid ? __('Delete') : __('Report')}}

Please write at least one word

Comments{{'(' + replyList.length + ')'}}

Yami Yami

{{ showTranslate(reply) }}Show Less

{{ strLimit(reply,800) }}Show more

Show Original

{{ reply.reply_content }}

{{ formatTime(reply.reply_in_dtm) }}

{{ reply.reply_likes_count }} {{ reply.reply_likes_count }} {{ reply.reply_reply_count }} {{reply.reply_in_user==uid ? __('Delete') : __('Report')}}

Please write at least one word

Cancel

That’s all the comments so far!

Write a review
How would you rate this item?

Please add your comment.

  • A nice nickname will make your comments more popular!
  • The nickname in your account will be changed to the same as here.
Thanks for your review
Our community rely on great reviews like yours to find the best of Asia.

Report

If you find this content inappropriate and think it should be removed from the Yami.com site, let us know please.

Cancel

Are you sure to delete your review?

Cancel

You’ve Recently Viewed

About the brand

Jingdong book