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

Irvine, Daniel

  • 出版商: Apress
  • 出版日期: 2023-03-10
  • 售價: $2,020
  • 貴賓價: 9.5$1,919
  • 語言: 英文
  • 頁數: 269
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1484292464
  • ISBN-13: 9781484292464
  • 海外代購書籍(需單獨結帳)

商品描述

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 JavaScript: 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.
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 JavaScript experience who are seeking to master the art of automated testing.

商品描述(中文翻譯)

學習撰寫更好的自動化測試,大幅提升生產力並在過程中享受樂趣。本書旨在個人閱讀和協作工作坊中使用,是一本自己動手建立冒險的書籍。
您將使用JavaScript建立一個xUnit自動化測試框架:一開始是Jest的克隆,但添加了一些從RSpec借來的巧妙功能,RSpec是行為驅動開發(BDD)的定義工具。在此過程中,您將探索自動化測試最佳實踐背後的哲學。自動化測試運行器是軟體工程中最重要的創新之一。但對於許多程式設計師來說,自動化測試仍然是一個謎,而知道如何撰寫良好的測試就像魔法一樣。
隨著本書的章節展開,您將看到這個不起眼的測試運行器是一個優雅且簡單的軟體。每一章都選擇一個要建立的功能,例如 'it' 函數或 'beforeEach' 區塊。它剖析了為什麼需要該功能的理論,以及如何在自己的測試套件中有效使用它。每一章結束時都會提供一些擴展點的想法,以供您個人或團體進一步探索。本書最後實現了測試替身和模擬的概念,這是自動化測試中最困難和被誤解的概念之一。
通過閱讀本書,您將獲得對自動化測試原則的扎實理解,並可以立即應用於工作項目中。
您將學到什麼


  • 建立一個xUnit自動化測試框架

  • 了解自動化測試運行器的運作方式

  • 瞭解自動化單元測試的最佳實踐

  • 有效使用測試替身和模擬

本書適合對象

具備JavaScript經驗的軟體開發人員,希望掌握自動化測試的藝術。

作者簡介

Daniel Irvine is a freelance software developer based in London. He works with a variety of languages including C#, Clojure, JavaScript, and Ruby. When he's not working, he spends time cooking, gardening and practicing yoga. He co-founded the Queer Code London meetup and is an active member of the European software craft community.

作者簡介(中文翻譯)

Daniel Irvine 是一位位於倫敦的自由軟體開發者。他使用多種程式語言,包括 C#、Clojure、JavaScript 和 Ruby。在工作之餘,他喜歡烹飪、園藝和練習瑜伽。他共同創辦了 Queer Code London 的聚會,並是歐洲軟體工藝社群的活躍成員。