Testing LiveView

Learn to test LiveView effectively. Gain trust in your code. Ship confidently.

Write tests that don't slow you down

Phoenix LiveView brings a new set of testing tools and requires a new way of thinking about our tests.

Don't write tests that:

only the original author understands
fail intermittently, costing you hundreds of hours of development time
run so slow you check Twitter every time you run them

Instead, master LiveView's new testing tools, learn the thought process behind what, when, and how to test LiveView, and rediscover the joy of having tests that are

fast 🏎
robust 💪, and
easy to maintain 🛠

The Course Outline

We'll cover everything you need to know. From fundamentals to mastery. And I'll keep publishing videos for testing-related changes until LiveView hits 1.0!

Testing a twitter clone

Throughout the course we'll test (and build) a twitter clone, a real application full of trade-offs and edge cases.

  • Testing Rendering

    The basics of setting up a LiveView test and making sure the initial page renders the correct information.

  • Scoping Assertions

    Let's get more precise about what we expect from LiveView's UI.

  • Testing Rendering Components

    A parent LiveView renders a list of LiveComponents. What should we test in the LiveView, and how should we test it?

  • Testing Live Components (Parts 1 & 2)

    How to test LiveComponents, what to test in them, and how to target elements that aren't simple text.

  • Testing Page Interactions

    Test interactivity from the perspective of the user. Targeting elements, clicking them, and expecting responses users can see.

  • Testing Live Patch

    When to test and when not to test live patch. And what are the alternatives?

  • Testing Live Navigation

    How to test navigation from LiveViews to other LiveViews and non-LiveViews.

  • Testing Forms

    Testing form submissions, changes, validations, and redirections.

  • Testing Event-Driven UIs (Parts 1 & 2)

    Testing event-driven updates to our Twitter clone.

Watwitter (our twitter clone) Timeline
  • Displaying New Posts

    Test users interacting with a page to show new posts.

  • Testing a User Can Like a Post (Parts 1-3)

    A deep dive into considering how to test interactions between LiveView, stateful LiveComponents, and the rest of our application.

  • Testing Broadcasting Likes (Parts 1 & 2)

    Seeing our own UI react to changes is not enough. We want to harness the power of Phoenix so that all users can see those changes too.

  • Making tests easy to read and understand

    As developers we spend a large portion of our time reading code. Let's see how to write our tests in a way that our colleagues (and our future selves) will easily understand.

  • Debugging LiveView Tests

    A quick dive into using the wonderful open_browser/1 helper to debug LiveView tests

  • Testing JavaScript Hooks

    Testing that we can scroll infinitely with JavaScript hooks.

  • Complex Assertions with Floki

    When the built-in LiveView tooling isn't enough, we drop into a lower-level of abstraction and use Floki to improve our assertions.

  • Testing Uploads (Parts 1-4)

    Whether you end up choosing to upload images to your server or to the cloud, we cover how to be confident that our application is uploading, saving, and displaying those uploads correctly.

Terminal showing test error

Check out a sample lesson


The Full Course

  • All videos

  • Access to the source code with detailed commits

  • Comment on any lesson along with other Elixirists

  • Detailed notes for all videos, so you can quickly reference anything without having to scrub through the video

  • Suggest topics for future videos

  • Message me about a difficult LiveView testing scenario you're currently experiencing, and I'll do my best to help, or even make a lesson of it!

Frequently asked questions

Can’t find the answer you’re looking for?

Send me an email

Who is this course for?
Developers who want to learn to test LiveView effectively, without creating tests that are brittle, slow, and hard to maintain.
What are the videos like?
Tons of live coding. You'll learn from the contents of the videos, but you'll also see my process for testing and interacting with code. You might even get inspired by my TDD flow and the editor setup that lets me run tests at the speed of thought.
How many lessons are there?
There are 28 lessons, each created to cover a single topic. Together they make over four and a half hours of content.
Do I need to know any LiveView?
I assume knowledge of LiveView in the course. Though you don't need to be an expert, it helps if you've seen it before. If you've never used LiveView, I recommend The Pragmatic Studio's LiveView Course.
Can I buy this for my team?
Definitely! Send me an email, and I can offer a team license (with a discount) that fits your team size.
Can I get a refund if I don't like the course?
What if the course is too expensive for me because I live in a different country?
No problem, I'm happy to give you a discount. Just send me an email and the country where you live, along with a suggested reasonable price for you in your country.
Is there an update coming?
Nice mind reading! 😀 Yes, I'm working on an update. If you want to find more about it and get exclusive insights into the process, you can sign up for updates.

I can't thank you enough for the course! It's allowed me to get comfortable with Elixir and Phoenix LiveView quickly as my career shifted from data science (C++, Python, R) to web-app testing & development.

Ian MacDonald
German Velasco

About Me

German Velasco

I'm a software developer who's been practicing test-driven development for almost a decade.

You might recognize me from my Testing LiveView ElixirConf talk, my TDD Phoenix book, or one of my blog posts.

For the past five years, I've been helping clients deal with slow test suites, intermittent failures, difficult test cases, and more.

Testing is my passion. I love thinking about it, iterating on practices, and figuring out how to write tests that are valuable, stable, and easy to maintain.

© 2023, German Velasco