Tests as docs? π€
Tests can serve as documentation. But the default `mix test` command doesn't print them out in a way that has clear information. Thankfully, there are two flags that can make it really nice.
Tests can serve as documentation. But the default `mix test` command doesn't print them out in a way that has clear information. Thankfully, there are two flags that can make it really nice.
If you want to improve your test suite speed, the first thing we want to do is find out what's the slowest module we have, right? Elixir 1.17's got your back.
Intermittent tests are a pain, but Elixir 1.17 has a really cool new flag in `mix test` to help us.
Elixir 1.17 shipped with a new feature that lets us put breakpoints right into our tests! All we have to do is run them with --breakpoints. Too good to be true? Check it out!
If I asked you what ExUnitβs `--seed` option does, you'd probably say 'randomize the order of tests', right? And that's right. But it turns out it does more!
What do you do when you want a temp directory in your tests? ExUnit's got your back with one simple trick!
Sometimes, it's helpful to see what queries our tests are making. There's a quick config change to do that!
Prior to Elixir 1.16 we couldn't run multiple test files with their line numbers. With Elixir 1.16, we can!
With LiveView's new async assigns, we can now load data asynchronously like a breeze. But how do we test it since we have async behavior? π€
I imagine many think ExUnit just does some type of scripting to run tests. But itβs a full Elixir app! Check it out.
The best way to write LiveView tests: follow the familiar setup-exercise-verify testing pattern
Anytime I need to inspect a page when testing LiveView, I reach for `open_browser/2`.
There are 2 ways to test Phoenix function components. But I recommend only using one of them!
Sometimes we need unique values in our tests. There's a nice ExUnit trick we can use.