Property-Based Testing with PropEr, Erlang, and Elixir: Find Bugs Before Your Users Do
暫譯: 使用 PropEr、Erlang 和 Elixir 的屬性基測試:在用戶之前找到錯誤
Fred Hebert
- 出版商: Pragmatic Bookshelf
- 出版日期: 2019-02-26
- 定價: $1,520
- 售價: 8.8 折 $1,338
- 語言: 英文
- 頁數: 250
- 裝訂: Paperback
- ISBN: 1680506218
- ISBN-13: 9781680506211
-
相關分類:
Functional-programming
立即出貨 (庫存 < 4)
買這商品的人也買了...
-
$980$774 -
$690$587 -
$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 -
$352OpenACC 並行編程實戰
-
$658多核與 GPU 編程:工具、方法及實踐
-
$2,660Oracle 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