
Episode 10
010: elm-test
We discuss the fundamentals of test-driven development, and the testing tools in the Elm ecosystem.
August 10, 20201h 0m
Audio is streamed directly from the publisher (cdn.simplecast.com) as published in their RSS feed. Play Podcasts does not host this file. Rights-holders can request removal through the copyright & takedown page.
Show Notes
elm-test Basics
- elm-test NPM package
elm-explorations/testElm packageelm-test initcommand- Running
elm-testfinds exposed values of typeTest
TDD Principles
- Testing in Elm is easier because it's just expectations of input to output (deterministic)
- TDD is a design practice too
- Programming by Intention
- Writing test first makes code testable & decoupled
- Red, green, refactor
- YAGNI
- "Make the change easy, then make the easy change"
- Kent Beck's TDD by Example
- Here's a staring template of a code kata in Elm that you can use to practice
- Emily Bache has many more code katas you can practice on her GitHub
Fuzz Testing
Also known as Property-Based Testing
Martin Janiczek's
elm-minithesisprojectelm-test's view testing API includesTest.Html.Query,Test.Html.Selector, andTest.Html.EventView objectsMocking and stubbing are not needed or possible in Elm
Order dependent test helper in Ruby:
i_suck_and_my_tests_are_order_dependent
When to Use Types or Tests
- Jeroen's Safe Unsafe Operations blog post
- Richard Feldman's talk on Types and Tests
- Make Impossible States
Should you test implementation details?
- Discourse thread discussing testing internals
- Think in terms of a modules responsibility
Higher-Level Testing in Elm
elm-program-test
Martin Janiczek's elm Europe talk on testing Msg's with ArchitectureTest
- Richard
test-updatepackage