Elm Radio

010: elm-test


Listen Later

elm-test Basics
  • elm-test NPM package
  • elm-explorations/test Elm package
  • elm-test init command
  • Running elm-test finds exposed values of type Test
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 project

  • elm-test's view testing API includes Test.Html.Query, Test.Html.Selector, and Test.Html.Event

View objects

  • Testing pyramid

  • Mocking 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
    ...more
    View all episodesView all episodes
    Download on the App Store

    Elm RadioBy Dillon Kearns, Jeroen Engels

    • 5
    • 5
    • 5
    • 5
    • 5

    5

    16 ratings