Why the world needs PhoenixTest

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ม.ค. 2025
  • ElixirConf US 2024 - German Velasco
    2024.elixircon...
    PhoenixTest is the missing library in the Elixir/Phoenix ecosystem.
    Think about it, we have well established libraries for other core web-app needs:
    Need interactive pages? LiveView
    Need a database mapper? Ecto
    Need a testing framework? ExUnit
    Need background job processing? Oban
    Need data pipelines? Broadway
    But how do we test Phoenix applications?
    … LiveViews are tested with LiveViewTest
    … controllers are (I guess) tested with controller tests?
    …. dynamicallly rendered pages (dead views) are tested with… 🤔(nothing?)
    Isn’t that shocking?!
    Phoenix is an amazing framework! But we don’t have a coherent, unified story around testing (like we do with ExUnit for Elixir).
    We could use Wallaby or Hound (I have in the past). But that comes with another set of downsides:
    Tests s-l-o-w d-o-w-n because everything is running through Chromedriver (an actual browser clicking buttons and stuff)
    We have intermittent test failures (since we’re now dealing with a browser and potentially async operations)
    We have Chromedriver failures! (Have you gotten that "invalid session id" error yet?😩)
    You now have two different ways of testing LiveViews and dead views (and what happens when you want to test interactions between the two?).
    That’s why I created PhoenixTest!
    Join me as I walk you through why the world* needs Phoenix test.
    We’ll talk about:
    where it fits in the ecosystem,
    why I think you should use it, and
    … I’ll roll up my sleeves and live code (🤯) to show you how awesome it can be to test drive a Phoenix app!
    You’ll come out equipped and ready to add PhoenixTest to your app for all your testing needs.

ความคิดเห็น •