inside front cover
The different techniques a developer should use to effectively and systematically test a software system
Effective Software Testing
A developer's guide
Maurcio Aniche
Foreword by Arie van Deursen and Steve Freeman
To comment go to liveBook
Manning
Shelter Island
For more information on this and other Manning titles go to
www.manning.com
Copyright
For online information and ordering of these and other Manning books, please visit www.manning.com. The publisher offers discounts on these books when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964
Email: orders@manning.com
2022 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.
Recognizing the importance of preserving what has been written, it is Mannings policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine.
| Manning Publications Co. 20 Baldwin Road Technical PO Box 761 Shelter Island, NY 11964 |
Development editors: | Kristen Watterson and Toni Arritola |
Technical development editor: | Frances Buontempo |
Review editor: | Mihaela Batini |
Production editor: | Andy Marinkovich |
Copy editor: | Tiffany Taylor |
Proofreader: | Jason Everett |
Technical proofreader: | Kevin Orr |
Typesetter: | Dennis Dalinnik |
Cover designer: | Marija Tudor |
ISBN: 9781633439931
front matter
forewords
In modern software development, software testing steers the design, implementation, evolution, quality assurance, and deployment of software systems. To be an effective developer, you must become an effective software tester. This book helps you to achieve that goal.
Put simply, testing is nothing but executing a piece of software to see if it behaves as expected. But testing is also hard. Its difficulty surfaces when thinking about the full set of test cases to be designed and executed. Out of the infinitely many possible test cases, which one should you write? Did you do enough testing to move the system to production? What extra tests do you need? Why these tests? And, if you need to change the system, how should you set up the test suite so that it supports rather than impedes future change?
This book doesnt shy away from such complex questions. It covers key testing techniques like design by contract, property-based testing, boundary testing, test adequacy criteria, mutation testing, and the proper use of mock objects. Where relevant, it gives pointers to additional research papers on the topic.
At the same time, this book succeeds in making sure the test cases themselves and the testing process remain as simple as can be justified. It does so by always taking the perspective of the developer who is actually designing and running the tests. The book is full of examples, ensuring that the reader can get started with applying the techniques in their own projects straight away.
This book emerged out of a course taught at Delft University of Technology for many years. In 2003 I introduced a course on software testing in the undergraduate curriculum. In 2016, Maurcio Aniche joined me in teaching the course, and in 2019 he took over the course entirely. Maurcio is a superb lecturer, and in 2021 the students elected him as Teacher of the Year of the faculty of Electrical Engineering, Mathematics, and Computer Science.
At TU Delft, we teach testing in the very first year of our Computer Science and Engineering bachelor program. It has been difficult finding a book that aligns with our vision that an effective software engineer must be an effective software tester. Many academic textbooks focus on research results. Many developer-oriented texts focus on specific tools or processes.
Maurcio Aniches Effective Software Testing fills that gap by finding the sweet spot between theory and practice. It is written with the working developer in mind, offering you state-of-the-art software testing techniques. At the same time, it is perfect for undergraduate university courses, training the next generations of computer scientists to become effective software testers.
Dr. Arie van Deursen , Professor in Software Engineering, Delft University of Technology, The Netherlands
Effective Software Testing by Maurcio Aniche is a practical introductory book that helps developers test their code. Its a compact tour through the essentials of software testing that covers major topics every developer should know about. The books combination of theory and practice shows the depth of Maurcios experience as an academic and as a working programmer.
My own path into software was rather haphazard: some programming courses at university, ad-hoc training on the job, and eventually a conversion course leading to a PhD. This left me envious of programmers who had taken the right courses at the right time and had the theoretical depth that I lacked. I periodically discovered that one of my ideas, usually with a half-baked implementation, turned out to be an established concept that I hadnt heard of. Thats why I think its important to read introductory material, such as this book.
Throughout much of my software life, I saw testing as a necessary evil that mostly involved the tedium of following text instructions by hand. Nowadays its obvious to most that test automation is best done by computers, but its taken decades for that to become so widely accepted. Thats why, to me, test-driven development, when I first came across it, initially seemed crazyand then essential.
That said, I see a lot of test code in the wild that really isnt clear. Obviously, this is easier to see in hindsight, without the immediate pressure of deadlines or after the domain model has settled. But I believe that this test code would be improved if more programmers used the techniques described in this book to structure and reason about the problems theyre working on. This doesnt mean that we all must turn into academics, but the light application of a few concepts can make a big difference. For example, I find design-by-contract helpful when working with components that maintain state. I might not always add explicit pre- and post-conditions to my code, but the concepts help me to think about, or discuss, what the code should do.