Testing Elixir (Pragmatic Bookshelf)

PragmaticBookshelf
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

Andrea Leopardi @whatyouhide and Jeffrey Matthias @idlehands

edited by Jacquelyn Carter @jkcarter

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.


  • Full details: Search
  • View this book’s portal and details on how to post errata and suggestions here.

Don’t forget you can get 35% off with your Devtalk discount! Just use the coupon code “devtalk.com" at checkout :+1:

Latest Threads About This Book Top

fabriziosestito
Andrea Leopardi (@whatyouhide) and Jeffrey Matthias (@idlehands), SoggyWaffle.WeatherCheckerTest is using the :set_mox_from_context setu...
New
adamu
Sorry, I know you asked us not to submit more errata on a recent podcast, but in the interest of correctness… The test on p22 sets up th...
New
rubyist
The code on page 16 of beta 6 uses setup_all but I believe this should be setup. The code in response_parser_test.bak.exs uses setup and ...
New
shaolang
First iteration that uses Process.sleep/1 works but the stab on using assert_receive doesn’t. I’ve even increased the timeout to 5,000 mi...
New
New
metal
Title: Testing Elixir: B5 Page 183 Url for stream_data repo should be https://github.com/whatyouhide/stream_data instead of https://gith...
New
metal
Title: Testing Elixir B5 (page 172) Inside the “Modified Boiler Plate” info box, the filename for error_tag/3 should be “lib/not_skull_w...
New
metal
Title: Testing Elixir (Source code) In the Makefile, provided in source code located at [code/testing_ecto & code/testing_phoenix/no...
New
metal
Title: Testing Elixir B5: page 128 Under Updating our Tests to include Database fields, Let’s update the test name to TestingEcto.Schem...
New
shaolang
A few issues on code to test average/1: add_element/2 in Enum.reduce/3 keeps adding 1 (one) to the list, but numbers in input_list are...
New

Most Active This Week Top

Most Active This Month Top

Most Active This Year Top

Most Active Last Three Years Top

fabriziosestito
Andrea Leopardi (@whatyouhide) and Jeffrey Matthias (@idlehands), SoggyWaffle.WeatherCheckerTest is using the :set_mox_from_context setu...
New

Most Active Over Three Years Top

New
PragmaticBookshelf
Write Elixir tests that you can be proud of. Dive into Elixir’s test philosophy and gain mastery over the terminology and concepts that u...
New
jasullivan
I believe the second to the last sentence in the third paragraph contains a few typos. The single element pattern in our anonymous funct...
New
adamu
The text reads: Additionally, we have to define the test’s pid outside of the function because self() wouldn’t be evaluated until the f...
New
dotdotdotpaul
Title: Testing Elixir - MapSet.new vs. Enum.sort (p. 80 PDF) The example on this page shows an assertion with the code: code: assert E...
New
scottswezey
The with_authenticated_user/1 code sample on PDF page 25 in B2.0 returns the user object, and not the authenticated_user object as I expe...
New
shaolang
First iteration that uses Process.sleep/1 works but the stab on using assert_receive doesn’t. I’ve even increased the timeout to 5,000 mi...
New
metal
Title: Testing Elixir (Source code) In the Makefile, provided in source code located at [code/testing_ecto & code/testing_phoenix/no...
New
imahiro
Is “make both functions public (def instead of def)” on PDF page 85 in B2.0 “make both functions public (def instead of defp)” ?
New
rubyist
The code on page 16 of beta 6 uses setup_all but I believe this should be setup. The code in response_parser_test.bak.exs uses setup and ...
New
metal
Title: Testing Elixir: B5 Page 183 Url for stream_data repo should be https://github.com/whatyouhide/stream_data instead of https://gith...
New
shaolang
A few issues on code to test average/1: add_element/2 in Enum.reduce/3 keeps adding 1 (one) to the list, but numbers in input_list are...
New
laurent
As per ISO 21500: Quality control is a set of activities for ensuring quality in the outputs of the project (the code here) whereas qua...
New
metal
Title: Testing Elixir B5: page 128 Under Updating our Tests to include Database fields, Let’s update the test name to TestingEcto.Schem...
New
shaolang
There’s no RollingAverageMeasurements.add_element/1 variant. The two calls to RollingAverageMeasurements.add_element should either be pip...
New

Get money off!

The Pragmatic Bookshelf

35% off any eBook

Simply use coupon code "devtalk.com" at checkout. See full details here.