Skip to Content
Java持续交付
book

Java持续交付

by Daniel Bryant, Abraham Marín-Pérez
November 2019
Beginner to intermediate
406 pages
9h 21m
Chinese
Publishing House of Electronics Industry
Content preview from Java持续交付
274
11
功能性测试:正确和接受度
mock
stub
的一个进化版本,它可以根据不同的模式配置不同的值,或者在每次测试之前
重新配置。它可以保持某个状态,并且可以在测试后查询是否调用了指定的方法,
以及如何被调用。
虚拟化服务
类似于一个
mock
,但它是长期存在的,被托管在一个远程服务器上。虚拟化服务通
常可以在开发人员和测试人员之间共享。
这些替代在组件测试中替换实际依赖的时候,都很有用,但是由于它们各自的特点,
mock
通常是最常用的方式。
stub
有时过于简单,无法覆盖组件测试中的某些情况,而虚
拟化服务则增加了远程网络连接的延迟和不确定性。
stub
通常需要手动来实现,但是
mock
和虚拟化服务可以使用某些工具。
在组件测试方面,
最常见的测试工具是
WireMock
WireMock
可以通过以下几种方式来实现
mock
或虚拟
化服务。
WireMock
来实现一个
mock
你可以在测试中随时启动和配置一个
WireMock
实例,在
ShopfrontApplicationCT
中你可以找到一个很好的示例,其中使用
WireMock
http://wiremock.org/
)来替代
Shopfront
依赖的外部服务。
WireMock
实现一个虚拟化服务
配置完成后,
WireMock
可以作为独立的服务启动,并部署到某个服务器中,使其
永久提供服务。或者你还可以选择
MockLab
https://get.mocklab.io/
),它是一个基
WireMock
的云服务,允许在云上创建虚拟化服务。
无论你选择哪种方式,在编写组件测试时要重点考虑的是,让它们独立于组件依赖的实 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

写给系统管理员的Python脚本编程指南

写给系统管理员的Python脚本编程指南

Posts & Telecom Press, Ganesh Sanjiv Naik
Python和NLTK实现自然语言处理

Python和NLTK实现自然语言处理

Posts & Telecom Press, Nitin Hardeniya
解密金融数据

解密金融数据

Justin Pauley
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu

Publisher Resources

ISBN: 9787121374425