coen.bakker
In an interview of José by Theo Browne, they mention the importance of “good” tests, in contrast to “bad” ones.
Specifically, they started talking about this from this timestamp on.
It’s not the focus of the interview, however, and it’s more of a short tangent. They don’t go into detail about what makes a test good or bad.
But now I am actually curious about the answer.
What are your ideas about this topic? And are there any learning resources you can recommend that cover this topic?
What I try to make sure when writing tests is that I am testing behaviour, rather than implementation details. But maybe there are still a ton of ways to mess the tests up, besides that?
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
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
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
coen.bakker
Quick something I wanted to add.
Some behaviours I’m coding seem to really call for tests. I might even feel lost without them. They help me write the function(s) with smaller cognitive load.
But sometimes I am writing tests for functions… And I don’t really see the benefit. Maybe the benefit is there, and I just don’t see it yet.
But it begs the question. When do you write tests? And when do you not?
An unnecessary test might also be considered “bad”, in some sense.
D4no0
I’m not a big guru on writing good tests yet, however testing goes hand in hand with design, bad unit tests point to bad design. This is one of the reasons why TDD or BDD are such a great thing, you design the system from the start with testability in mind, and you will also get benefits like isolation and separation of concerns out of the box for free (if you write unit tests correctly ofc).
One of the lessons I learned the hard way is to always keep unit tests isolated, if you start to couple them you will have brittle tests that will start to collapse once you make some small changes, same goes for the detail implementations.
I didn’t watch the video, however this discussion popped a lot of times on this forum. Writing tests to check the types is in my opinion in category of those bad unit tests that check implementation details, however I have never seen those kind of tests in my career so maybe the wording is misleading.
LostKobrakai
I think this section of an earlier keynote by jose goes into more details on the point he’s trying to make:
cevado
I have a few rules of thumb when it regards tests:
I think other stuffs apply, but they’re usually related with context of your codebase, what is more important and what is crucial for your application.
sodapopcan
This is a can-of-worms topic
I love talking about this stuff and could talk about it for hours (and I have!) even though I would still not call myself anything close to an expert.
This talk is an oldie but a goodie.
dimitarvp
I always had difficulties putting the “bad” label on tests. The only truly bad tests I can think of is checking if your libraries are working at all, and even that is not 100% because at one point you want any guarantee you can get so it does make sense to have integration-like tests that also check if your 3rd party dependencies do what you want them to do.
The objectively good tests to me are property tests. As @cevado said above, your tests should check the edge cases and property tests are really good at that (though within limits; it depends how well you have modeled your property test generators).
I’d say the best tests you can get are those that you feel are validating your app’s / library’s functionality about which you care the most. Don’t let others tell you what’s good or bad.