Build Your Own Test Framework: A Practical Guide to Writing Better Automated Tests

Автор: literator от 10-03-2023, 01:45, Коментариев: 0

Категория: КНИГИ » ПРОГРАММИРОВАНИЕ

Build Your Own Test Framework: A Practical Guide to Writing Better Automated TestsНазвание: Build Your Own Test Framework: A Practical Guide to Writing Better Automated Tests
Автор: Daniel Irvine
Издательство: Apress
Год: 2023
Страниц: 267
Язык: английский
Формат: pdf, epub
Размер: 10.2 MB

Learn to write better automated tests that will dramatically increase your productivity and have fun while doing so. This book is a build-your-own adventure designed for individual reading and for collaborative workshops.

You will build an xUnit automated test framework using jаvascript: initially a clone of Jest, but adding a couple of neat features borrowed from RSpec, the genre-defining tool for behavior-driven development (BDD). Along the way, you will explore the philosophy behind automated testing best practices. The automated test runner is one of the most important innovations within software engineering. But for many programmers, automated testing remains a mystery, and knowing how to write good tests is akin to sorcery.

This book is a follow-along practical exercise in building an automated unit test framework, written in the jаvascript language and running on the Node platform. You can think of it as a less functional replacement for well-known packages like Jest, Mocha, Jasmine, and Vitest.

The framework is called concise-test, and it takes the form of an NPM package that you’ll start building in Chapter 1. The book also makes use of a package named todo-example, which is a sample application that will make use of concise-test, as a package dependency.

By the end of Chapter 1, you’ll be able to run the command npm test in your todo-example project directory and have your test runner execute the application test scripts.

Do I Need to Know jаvascript? You’ll need to know modern jаvascript syntax to use this book, including arrow functions, destructuring assignments, and rest parameters. It also uses ECMAScript Modules for importing and exporting values. That being said, don’t stop reading if you don’t know any jаvascript; as long as you have experience in at least one programming language, you should be able to pick it up as we go along. If you’re unsure what some of the syntax means, take a moment to stop and look it up online. jаvascript is a wonderfully flexible language. It is dynamic and functional at its core, but also has support for objects in a rather unique way, which is empowering.

The beauty of unit testing is that it is universally applicable to all mainstream programming languages, so if you were really keen, you could rebuild all of the same code in your own favorite language. The only chapters that are directly related to jаvascript are Chapters 9 and 17.

As the chapters of this book unfold, you will see how the humble test runner is an elegant and simple piece of software. Each chapter picks a single feature to build, like the "it" function or the "beforeEach" block. It picks apart the theory of why the feature needs to exist, and how to use it effectively in your own test suites. Every chapter ends with a set of ideas for extension points should you wish to explore further, alone or in groups. The book culminates in an implementation of test doubles and mocks―one of the most difficult and misunderstood concepts within automated testing.

By the end of the book, you will have gained a solid understanding of automated testing principles that you can immediately apply to your work projects.

What You'll Learn:
Build an xUnit automated test framework
See how an automated test runner works
Understand the best practices for automated unit testing
Effectively use test doubles and mocks

Who This Book Is For:
Software developers with jаvascript experience who are seeking to master the art of automated testing.

Скачать Build Your Own Test Framework: A Practical Guide to Writing Better Automated Tests








Нашел ошибку? Есть жалоба? Жми!
Пожаловаться администрации
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.
Информация
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.