thiagomajesk

thiagomajesk

YOU DONT UNIT TEST? DevHour #1 Theo

Found this on my Youtube feed today after watching another clip on Merge vs Rebase workflows (which was really cool to watch BTW)… The (in)famous Primeagen talks with this Theo guy (ex Twitch apparently) about their opinions on Unit Tests, very fun to watch…

So, I’m sharing this because I think I can collect some diverse opinions on the topic; especially how you think Elixir plays a part (if any) in helping solve the problems they talk about. Even though I have my own opinions on the topic, I can’t personally relate to some of the struggles because I haven’t worked on this kind of scale (like Netflix and Twitch). Therefore, it would be awesome to hear from y’all, critics, adepts of TDD, and everyone in between.

Disclaimer: The video contains a lot of strong opinions, sarcasm, and even a little bit of humorous trash-talking about Elixir near the end, so have fun and take all of it with a huge grain of salt.

Most Liked

brightball

brightball

Personally, I like to start with a big integration test.

Just use comments to map out the most complicated process front to back, the replace the comments with tests the whole way down (with no UI). I find that this approach plays really nicely with forcing you through a lot of architecture decisions.

Then, when that primary use case is working I’ll go fill in more targeted tests around different types of data in different pieces of the system.

And after all that, I’ll have a working and stable backend that’s ready for a UI.

tfwright

tfwright

Enjoyed this, love the passion.

My own take on TDD is that it’s a personal style. If you’re writing a feature, no one can “prove” that you followed TDD, you can write the whole feature and then retroactively write the tests, obviously. But on teams, precisely when we’re doing code review, I find it really helpful when there are unit tests to document how the logic is supposed to behave with various inputs. So I wonder why TDD is being linked so closely with the value of unit tests generally.

My other main thought is that FE development is fundamentally a different beast than BE. Writing elixir apps I find it almost trivial to add really good, but basic, unit tests (also 100% agree that “coverage” is at best a misleading metric). Mocking external factors in elixir code is so much easier than mocking UI state in a react app. I still find unit testing really valuable on the FE but it definitely extracts a steep price in terms of dev time, and that should be considered.

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2976 91332 914
New
f0rest8
Hi everyone :waving_hand: Posting here to showcase and announce that Metamorphic is now officially live on a public-facing domain at htt...
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement