Testing Elixir: Effective and Robust Testing for Elixir and Its Ecosystem

Leopardi, Andrea, Matthias, Jeffrey

  • 出版商: Pragmatic Bookshelf
  • 出版日期: 2021-08-17
  • 定價: $1,575
  • 售價: 9.0$1,418
  • 語言: 英文
  • 頁數: 220
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1680507826
  • ISBN-13: 9781680507829
  • 相關分類: Functional-programming
  • 立即出貨 (庫存=1)

買這商品的人也買了...

商品描述

Elixir offers new paradigms, and challenges you to test in unconventional ways. Start with ExUnit: almost everything you need to write tests covering all levels of detail, from unit to integration, but only if you know how to use it to the fullest - we'll show you how. Explore testing Elixir-specific challenges such as OTP-based modules, asynchronous code, Ecto-based applications, and Phoenix applications. Explore new tools like Mox for mocks and StreamData for property-based testing. Armed with this knowledge, you can create test suites that add value to your production cycle and guard you from regressions.

Write Elixir tests that you can be proud of. Dive into Elixir's test philosophy and gain mastery over the terminology and concepts that underlie good tests. Create and structure a comprehensive ExUnit test suite, starting from the basics, and build comprehensive test coverage that will provide safety for refactoring and confidence that your code performs as designed. Use tests to make your software more reliable and fault tolerant.

Explore the basic tool set provided by ExUnit and Mix to write and organize your test suite. Test code built around different OTP functionality. Isolate your code through dependency injection and by using Mox. Write comprehensive tests for Ecto projects, covering Ecto as a database tool as well as a standalone data validation tool. Test Phoenix channels from end to end, including authentication and joining topics. Write Phoenix controller tests and understand the concepts of integration testing in Elixir. Learn property-based testing with StreamData from the author who wrote the library.

Code with high confidence that you are getting the most out of your test suite, with the right tools that make testing your code a pleasure and a valuable part of your development cycle.

What You Need:

To get the most out of this book, you will need to have installed Elixir 1.8 or later and Erlang/OTP 21 or later. In order to complete the relevant chapters, you will also need Ecto 3.1 or later, EctoSQL 3.1 or later and Phoenix 1.3 or later.

商品描述(中文翻譯)

Elixir 提供了新的範式,並挑戰您以非傳統的方式進行測試。從 ExUnit 開始:幾乎包含了您需要撰寫測試的所有細節層級,從單元測試到整合測試,但前提是您知道如何充分利用它 - 我們將向您展示如何做到。探索測試 Elixir 特定的挑戰,例如基於 OTP 的模組、非同步程式碼、基於 Ecto 的應用程式和 Phoenix 應用程式。探索像 Mox 這樣的新工具,用於模擬和 StreamData 進行基於屬性的測試。憑藉這些知識,您可以創建增加生產週期價值並保護您免受回歸的測試套件。

撰寫令您引以為傲的 Elixir 測試。深入研究 Elixir 的測試哲學,並掌握良好測試的術語和概念。從基礎開始創建和結構化全面的 ExUnit 測試套件,並建立全面的測試覆蓋範圍,以提供重構的安全性和確保您的程式碼按照設計執行。使用測試使您的軟體更可靠和容錯。

探索由 ExUnit 和 Mix 提供的基本工具集,以撰寫和組織您的測試套件。測試圍繞不同 OTP 功能構建的程式碼。通過依賴注入和使用 Mox 來隔離您的程式碼。為 Ecto 專案撰寫全面的測試,包括將 Ecto 作為資料庫工具和獨立資料驗證工具。從頭到尾測試 Phoenix 通道,包括身份驗證和加入主題。撰寫 Phoenix 控制器測試,並了解 Elixir 中整合測試的概念。從撰寫該庫的作者那裡學習使用 StreamData 進行基於屬性的測試。

以高度自信的方式編寫程式碼,確保您的測試套件發揮最大效益,使用正確的工具使測試程式碼成為開發週期中令人愉悅且有價值的一部分。

您需要什麼:

為了充分利用本書,您需要安裝 Elixir 1.8 或更新版本以及 Erlang/OTP 21 或更新版本。為了完成相關章節,您還需要 Ecto 3.1 或更新版本、EctoSQL 3.1 或更新版本以及 Phoenix 1.3 或更新版本。

作者簡介

Andrea Leopardi is a software developer and engineer with a passion for programming and code design. He loves beautiful and thoroughly tested code. He's a member of the core team of the Elixir programming language. He's also a frequent public speaker and trainer.

Jeffrey Matthias is a software engineer and industrial designer who loves modularity and quick feedback loops, two things that testing can help facilitate in code. When he's not coding, he's (helping his awesome wife with) raising his two kids and starting projects that he might finish someday.

作者簡介(中文翻譯)

Andrea Leopardi 是一位熱愛程式設計和程式碼設計的軟體開發人員和工程師。他喜歡美麗且經過徹底測試的程式碼。他是 Elixir 程式語言核心團隊的成員,也是一位頻繁的公開演講者和培訓師。

Jeffrey Matthias 是一位軟體工程師和工業設計師,他喜歡模組化和快速反饋迴圈,這兩個因素都可以透過測試來促進程式碼的開發。當他不在寫程式時,他會(幫助他很棒的妻子)撫養他的兩個孩子,並開始一些他可能有一天會完成的專案。