Tune in to the tools and techniques in the Elm ecosystem.
010: elm-test
August 10, 2020
1:00:34
58.35 MB
Downloads: 0
elm-test
Basics
- elm-test NPM package
elm-explorations/test
Elm packageelm-test init
command- Running
elm-test
finds 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-minithesis
projectelm-test
's view testing API includesTest.Html.Query
,Test.Html.Selector
, andTest.Html.Event
View 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-update
package