Автор: Roy Osherove, Vladimir Khorikov
Издательство: Manning Publications
Год: 2024
Страниц: 289
Язык: английский
Формат: True/Retail PDF EPUB
Размер: 12.5 MB
Unit testing is more than just a collection of tools and practices—it’s a state of mind! This bestseller reveals the master’s secrets for delivering robust, maintainable, and trustworthy code.
Thousands of developers have learned to hone their code quality under the tutelage of The Art of Unit Testing. This revised third edition updates an international bestseller to reflect modern development tools and practices, as well as to cover jаvascript.
Inside The Art of Unit Testing, Third Edition you will learn how to:
Create readable, maintainable, and trustworthy tests
Work with fakes, stubs, mock objects, and isolation frameworks
Apply simple dependency injection techniques
Refactor legacy code with confidence
Test both frontend and backend code
Effective unit tests streamline your software development process and ensure you deliver consistent high-quality code every time. With practical examples in jаvascript and Node, this hands-on guide takes you from your very first unit tests all the way to comprehensive test suites, naming standards, and refactoring techniques. You’ll explore test patterns and organization, working with legacy code and even “untestable” code. The many tool-agnostic examples are presented in jаvascript and carefully designed so that they apply to code written in any language.
What’s new in the third edition:
In this third edition, we switched from .NET to jаvascript and TypeScript. All the related tools and frameworks got updated, too, of course. For example, instead of NUnit test runner and NSubstitute, we used Jest, both as a unit testing framework and as a mocking library. We added more techniques to the chapter about implementing unit testing at the organizational level.
There are plenty of design changes in the code we show in the book. They are mostly related to the use of dynamically typed languages such as jаvascript, but we talk about statically typed techniques as well with the help of TypeScript. The discussion about test trustworthiness, maintainability, and readability has been expanded into three separate chapters. We also added a new chapter about testing strategies: how to decide between different test types and what techniques to use.
About the Technology
The art of unit testing is more than just learning the right collection of tools and practices. It’s about understanding what makes great tests tick, finding the right strategy for each unique situation, and knowing what to do when the testing process gets messy. This book delivers insights and advice that will transform the way you test your software.
About the Book
The Art of Unit Testing, Third Edition shows you how to create readable and maintainable tests. It goes well beyond basic test creation into organization-wide test strategies, troubleshooting, working with legacy code, and “merciless” refactoring. You’ll love the practical examples and familiar scenarios that make testing come alive as you read. This third edition has been updated with techniques specific to object-oriented, functional, and modular coding styles. The examples use jаvascript.
What's Inside
Deciding on test types and strategies
Test Entry & Exit Points
Refactoring legacy code
Fakes, stubs, mock objects, and isolation frameworks
Object-Oriented, Functional, and Modular testing style
Who should read this book
The book is for anyone who writes code and is interested in learning best practices for unit testing. All the examples are written in jаvascript and TypeScript, so jаvascript developers will find the examples particularly useful. But the lessons we teach apply equally to most, if not all, object-oriented and statically typed languages (C#, VB.NET, Java, and C++, to name a few). If you’re an architect, developer, team lead, QA engineer (who writes code), or novice programmer, this book should suit you well.
Скачать The Art of Unit Testing: With Examples in jаvascript, 3rd Edition (Final Release)