Property-Based Testing with PropEr, Erlang, and Elixir: Find Bugs Before Your Users Do
Fred Hebert
- 出版商: Pragmatic Bookshelf
- 出版日期: 2019-02-26
- 定價: $1,520
- 售價: 9.5 折 $1,444
- 語言: 英文
- 頁數: 250
- 裝訂: Paperback
- ISBN: 1680506218
- ISBN-13: 9781680506211
-
相關分類:
Functional-programming
立即出貨 (庫存 < 4)
買這商品的人也買了...
-
$980$774 -
$690$538 -
$680$537 -
$580$493 -
$403代碼的未來
-
$780$616 -
$520$411 -
$480$379 -
$520$406 -
$680$537 -
$580$458 -
$454Erlang 程序設計, 2/e (Programming Erlang: Software for a Concurrent World, 2/e)
-
$480$379 -
$458你必須知道的 495個 C語言問題
-
$539$512 -
$414$393 -
$658多核與 GPU 編程:工具、方法及實踐
-
$2,520Oracle Database 12c Release 2 Performance Tuning Tips & Techniques (Oracle Press)
-
$959$911 -
$580$458 -
$354$336 -
$403OpenACC並行程序設計:性能優化實踐指南
-
$587高伸縮性系統 : Erlang/OTP 大型分佈式容錯設計
-
$534$507
相關主題
商品描述
Property-based testing helps you create better, more solid tests with little code. By using the PropEr framework in both Erlang and Elixir, this book teaches you how to automatically generate test cases, test stateful programs, and change how you design your software for more principled and reliable approaches. You will be able to better explore the problem space, validate the assumptions you make when coming up with program behavior, and expose unexpected weaknesses in your design. PropEr will even show you how to reproduce the bugs it found. With this book, you will be writing efficient property-based tests in no time.
Most tests only demonstrate that the code behaves how the developer expected it to behave, and therefore carry the same blind spots as their authors when special conditions or edge cases show up. Learn how to see things differently with property tests written in PropEr.
Start with the basics of property tests, such as writing stateless properties, and using the default generators to generate test cases automatically. More importantly, learn how to think in properties. Improve your properties, write custom data generators, and discover what your code can or cannot do. Learn when to use property tests and when to stick with example tests with real-world sample projects. Explore various testing approaches to find the one that's best for your code. Shrink failing test cases to their simpler expression to highlight exactly what breaks in your code, and generate highly relevant data through targeted properties. Uncover the trickiest bugs you can think of with nearly no code at all with two special types of properties based on state transitions and finite state machines.
Write Erlang and Elixir properties that generate the most effective tests you'll see, whether they are unit tests or complex integration and system tests.
What You Need
- Basic knowledge of Erlang, optionally Elixir
- For Erlang tests: Erlang/OTP >= 20.0, with Rebar >= 3.4.0
- For Elixir tests: Erlang/OTP >= 20.0, Elixir >= 1.5.0
商品描述(中文翻譯)
物件屬性測試能夠幫助您以少量程式碼創建更好、更穩固的測試。透過在 Erlang 和 Elixir 中使用 PropEr 框架,本書教導您如何自動生成測試案例、測試有狀態的程式,並改變軟體設計方式以達到更有原則和可靠的方法。您將能夠更好地探索問題空間,驗證在設計程式行為時所做的假設,並揭示設計中意想不到的弱點。PropEr 甚至能夠展示如何重現它發現的錯誤。透過本書,您將能夠立即撰寫高效的物件屬性測試。
大多數測試僅證明程式碼的行為與開發者預期相符,因此在特殊條件或邊界情況出現時,也會有相同的盲點。透過使用 PropEr 撰寫物件屬性測試,學會以不同的角度看待事物。
從物件屬性測試的基礎開始,例如撰寫無狀態屬性和使用預設生成器自動生成測試案例。更重要的是,學會以屬性的方式思考。改進您的屬性,撰寫自訂資料生成器,並發現您的程式碼能夠做什麼或不能做什麼。學會何時使用物件屬性測試,以及何時使用實際範例測試進行真實世界的專案。探索各種測試方法,找到最適合您程式碼的方法。將失敗的測試案例縮小到最簡單的表達形式,以凸顯程式碼中出錯的地方,並透過針對性的屬性生成高度相關的資料。透過基於狀態轉換和有限狀態機的兩種特殊屬性類型,發現您能夠想到的最棘手的錯誤,而幾乎不需要任何程式碼。
撰寫能夠生成最有效測試的 Erlang 和 Elixir 屬性,不論是單元測試還是複雜的整合和系統測試。
所需條件
- 基本的 Erlang 知識,可選擇性地使用 Elixir
- 對於 Erlang 測試:Erlang/OTP >= 20.0,Rebar >= 3.4.0
- 對於 Elixir 測試:Erlang/OTP >= 20.0,Elixir >= 1.5.0