测试工程师的领航指南:《Effective软件测试》

本书的作者Mauricio Aniche,是荷兰代尔夫特理工大学的软件工程助理教授,他致力于软件测试方面的教学并赢得了2021年度计算机科学教师奖和代尔夫特理工大学教育奖学金,拥有巴西圣保罗大学计算机科学硕士和博士学位。
Mauricio坚信软件工程将很快成为一个更加以科学为基础的领域。他的目标之-是确保从业者了解学者在研究什么,并确保学者了解从业者在日常工作中面临的真正挑战。

前言

之前在学习软件测试的过程中,我遇到了很多问题,找同事只能解决当下的问题,所以我一直想找本书系统地进行学习,后来看到《Effective软件测试》这本书。这本书给我了很多灵感与感悟,所以在我阅读后写了这篇文章分享给大家。在阅读这本书的时候,你会发现你在工作中的实践都会与书中的每一条内容产生强烈碰撞,并且你会对测试领域的认知有更深的体会。这本书系统的介绍了测试的本质、方式、思维、设计等等,它会在你进行编写测试的时候将你的思维发散,真的很受启发!

一、我们为什么要学习测试

在我们的开发中,大多数开发者不喜欢写测试,当然我也听到过很多理由:写产品代码更有趣、更有挑战性,软件测试太费时,我拿的工资是用来写产品代码的等等。但是在实际工作中的真实情况是开发者高估了他们花在测试上的时间。这本书会让你对测试开发有一个新的了解:

  • 作为一名开发者,有责任确保所开发的软件的质量;

  • 测试是帮助我们履行这一责任的唯一工具;

  • 如果我们掌握了一系列技术,就能以有效和系统的方式测试自己的代码。

二、本书适合对象

  • 本书可以学习更多有关测试知识或提高测试技能,如果你有多年的软件工程经验并且写过很多自动化测试,但总是按照自己的直觉来判断下一个测试用例应该是什么,那么本书将为你呈现系统性的思维过程。

  • 不同专业水平的开发者都能从本书中收获到各自的感悟。新手开发者可以跟随笔者介绍的所有代码示例和技术来学习。高级开发者可以了解他们可能不熟悉的技术,并从每一章的务实讨论中学到知识。

三、本书大纲

第1章 有效和系统的软件测试
第2章 基于需求规格的测试
第3章 结构化测试与代码覆盖
第4章 契约式设计
第5章 基于属性的测试
第6章 测试替身和模拟对象
第7章 可测试性设计
第8章 测试驱动的开发
第9章 编写大型测试
第10章 测试代码的质量
第11章 全书总结

第1章:有效和系统的软件测试

构建了系统且有效的软件测试的案例。我们举了一个涉及两名开发者的例子——两者都实现了相同的功能,一个是随意的,另一个是系统性的——并指出了两种方法之间的差异。然后讨论了单元测试、集成测试和系统测试之间的区别,并认为开发者首先应该关注快速的单元测试和集成测试(众所周知的测试金字塔)。

第2章:基于需求规格的测试

介绍了领域测试,这种测试实践侧重于基于需求的工程测试用例。软件开发团队在需求方面使用不同的实践(用户故事、UML或内部格式),并且领域测试会使用这些信息。每个测试会话都应该从正在开发的功能需求开始。

第3章:结构化测试与代码覆盖

展示了如何在领域测试之后,使用程序的源代码和结构来增强测试。可运行代码覆盖率工具,并使用其结果来反映最初的测试集没有覆盖的代码部分。一些开发者不认为代码覆盖率是一个有用的指标,但在该章中,我们希望让大家相信,如果应用得当,代码覆盖率测试应该是测试过程的一部分。

第4章:契约式设计

讨论质量超越测试的想法:效果取决于如何为代码建模,以及我们的方法和类赋予系统其他类和方法的确定性。契约式设计使代码的前置条件和后置条件明确。这样一来,如果出现问题,程序将停止而不会引起其他问题。

第5章:基于属性的测试

介绍基于属性的测试。我们不是基于单个具体例子编写测试,而是测试程序的所有属性。测试框架负责生成与属性匹配的输入数据。掌握这项技术可能很棘手:表达属性并不容易,而且需要很多练习。基于属性的测试也更适合某些代码片段。该章有很多证明这个概念的示例。

第6章:测试替身和模拟对象

讨论了超越设计良好的测试用例的实用性。在更复杂的系统中,类依赖于其他类,编写测试可能成为一种负担。我们介绍了模拟对象(Mock)和桩对象(Stub),它们让我们在测试期间可以忽略一些依赖关系。还讨论了一个重要的权衡:尽管模拟对象简化了测试,但也使测试与生产代码更加耦合,这可能导致测试代码不能优雅地演化。该章讨论了模拟对象的利弊,以及何时使用(或不使用)它们。

第7章:可测试性设计

解释了在设计时考虑了可测试性的系统与不考虑可测试性的系统之间的区别。我们讨论了几种简单的模式,它们将帮助我们编写易于控制和易于观察的代码(任何进入测试世界的开发者的梦想)。该章讨论了软件设计和测试的关系——正如我们将看到的,它们之间有着密切的关系。

第8章:测试驱动的开发

讨论测试驱动开发(TDD):在开发产品代码之前编写测试。 TDD是一种非常流行的技术,尤其是在敏捷实践者中。即使你已经熟悉了 TDD,也建议你阅读这一章——笔者对如何应用TDD有一些不同寻常的看法,尤其是在你认为TDD没有太大作用的情况下。

第9章:编写大型测试

本章节超越了单元测试,讨论了集成和系统测试。将之前章节中所讨论的测试技术(例如领域测试和结构化测试)直接应用到这里。编写集成测试和系统测试需要更多的代码,所以如果我们不能很好地组织代码,最终可能得到一个复杂的测试集。该章介绍了编写可靠且易于维护的测试集的几个最佳实践。

第10章:测试代码的质量

讨论了测试代码的最佳实践。以自动化方式编写测试是测试流程的基本内容。我们还希望编写易于理解和维护的测试代码。该章介绍了最佳实践(我们希望从测试中得到的)和不良实践(我们不希望在测试中出现的)。

第11章:全书总结

重新审视了本书涵盖的一些概念,强化了重要的主题,并就下一步的发展方向提供了一些建议。

四、最后

我认为这本书是一本永远值得再次阅读的书,阅读这本书后,你会发现它教给测试人员不仅仅是“思辨思维”,更多的是会让你在今后的测试工作以新的方式去,这是最为重要的财富。它教授了测试的基本原则和技巧,还培养了测试人员独立思考和解决问题的能力。它不仅仅是一本关于测试的书,更是一本关于思考和学习的书,对于职业发展和个人成长都具有巨大的帮助。所以非常值得推荐给大家!

🌟赠书福利

🔥送书福利:《Effective软件测试》
参与方式:评论区进行优质评论
截止时间:即日 - 2023.9.6 12:00 抽3位小伙伴各赠送一本实体书
PS:如果没有抽到书籍的想自己购买,购书传送门:点击购买

在这里插入图片描述

Introduction There are many books about software testing management. When they discuss software test automation, they introduce third-party testing tools. This book describes techniques for developing a fully automated software testing tool. You can use this tool to generate test scripts for continuous unit testing, integration testing, and regression testing. Software defects are common and cause economic losses from time to time. Today, software organizations invest more time and resources in analyzing and testing software as a unit rather than as independent entities. Software engineers have observed that writing testing code is as expensive and time consuming as developing the product itself. To ensure software quality, organizations encourage software developers and testers to achieve objectives such as these: Locating the source of defects faster and more precisely Detecting bugs earlier in the software development life cycle Removing more defects before the product is released Improved testing tools can reduce the cost of software development and increase the quality of software. An automated testing tool must have the following characteristics: Accurate functionality, reliability, interoperability, and compliance An interface that is user friendly and easy to learn and operate Enhanced fault tolerance and automatic error recoverability Efficient algorithm for time and resource management Stable and mature final products that can be maintained and upgraded Easy portability with regard to installation, uninstallation, adaptability, and security I have used many of the commercial software test tools. Their developers declare that they have the capability to conduct various types of software tests and meet the requirements of an organization. But they have limitations. For example, some of them require users to record a series of mouse clicks and keystrokes. Others require users to write test scripts in a specified script language or to generate a test script automatically to test only one function (member) of a software module. Furthermore, the test scripts produced by these tools and methods need to be edited and debugged before they can be executed to perform the desired tests. Automatic generation of the testing data is beyond the reach of these tools, and integration testing involves extensive manual stubbing and guesswork. Software test engineers would like to see a fully automated software test tool on the market, one that is capable of completing testing tasks from generating test scripts and composing the testing cases to presenting the results and fixing the bugs. But the tool vendors are not able to keep up with the complexity and technology advancements in today’s software projects. In addition, software products can include features that incorporate a company’s trade secrets, which the commercial testing tools won’t have the capability of testing. Engineers are often in the position of having to develop their own tools to cover the gaps. This book presents a way to develop and enhance a testing tool development with full automation. When I was trained to use commercial tools, the trainers from the manufacturers presented hundreds of testing features. Software test engineers do appreciate these features, and they are important in improving the quality of software. But the tedious and time-consuming processes of editing and debugging the generated test scripts sometimes prevent a thorough software test. Thus, software products are delivered to end users with costly errors. These costs are shared by virtually all businesses in the United States that depend on software for their development, production, distribution, and after-sales supports and services. To address these current inadequacies, this book will introduce an automated method to minimize the data editing steps, generate a test script to test the entire application, and free you from having to edit and debug the test script manually. The final product simply accepts an application under test and delivers the test results. Who This Book Is For Software engineers have long relied on the tools and infrastructures supplied by the current software testing tool vendors. Some engineers tell successful stories. But more engineers experience frustrations. The automation is not enough, the test is not efficient, and the test script generation and data composition methods need to be improved. One expert’s solution to software test automation is to develop testing tools instead of purchasing commercial tools developed with the current inadequate infrastructure. This book is written for people who are involved in software engineering and want to automate the software testing process for their organizations. With the methods introduced by this book, software engineers should gain a good understanding of the limited automation provided by the available testing tools and how to improve the current test infrastructure and conduct a fully automated software test. This book is for software engineers who want more effective ways to perform software tests. The automated test tool introduced in this book can serve as an independent software test tool as well as an adjunct to the commercial tools. I assume you are a moderately experienced software developer and a test engineer in the process of conducting software test for your organization. The explanations and examples in this book can be easily understood and followed by any intermediate- to advanced-level programmer interested in expanding their knowledge in both software development and software testing. Knowledge of the fundamentals of software testing is essential for software test engineers. Examining a combination of programming and testing issues leads to a solid solution to software test automation. This book’s content includes sound programming techniques with examples in C#. Then it gradually progresses to the development of a fully automated test tool. Although the sample code is in C# using the Microsoft Windows platform, the concept can be used with other languages and platforms. As economists have reported, software failures result in a substantial economic loss to the United States each year. Approximately half of the losses occur within the software manufacturing industry. If you are a senior managerial administrator of a software organization, you are most likely interested in an improved software test method. The other half of the loss comes out of the pockets of the software end users. If your business or institution consists of software end users, you probably maintain teams to support the software purchased from the contract vendors. Being aware of testing methods will assist you with efficient software application in your organization.
评论 43
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不叫猫先生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值