Remix.run Logo
pmontra 4 hours ago

> In Elixir tests, each test runs in a database transaction that rolls back at the end. Tests run async without hitting each other. No test data persists.

And it confuses Claude.

This way of running tests is also what Rails does, and AFAIK Django too. Tests are isolated and can be run in random order. Actually, Rails randomizes the order so if the are tests that for any reason depend on the order of execution, they will eventually fail. To help debug those cases, it prints the seed and it can be used to rerun those tests deterministically, including the calls to methods returning random values.

I thought that this is how all test frameworks work in 2026.

netghost 3 hours ago | parent | next [-]

I did too, and I've had a challenging time convincing people outside of those ecosystems that this is possible, reasonable, we've been doing it for over a decade.

gavmor 3 hours ago | parent | next [-]

Story of my life in so many dimensions.

njhnjhnjh an hour ago | parent | prev [-]

[flagged]

vmg12 2 hours ago | parent | prev | next [-]

Why not just write to the db? Just make every test independent, use uuids / random ids for ids.

mystifyingpoi an hour ago | parent | next [-]

> Just make every test independent

That's easier said than done. Simple example: API that returns a count of all users in the database. The obvious correct implementation that will work would be just to `select count(*) from users`. But if some other test touches users table beforehand, it won't work. There is no uuid to latch onto here.

2 hours ago | parent | prev | next [-]
[deleted]
vladraz 41 minutes ago | parent | prev | next [-]

Frankly this is the better solution for async tests. If the app can handle multiple users interacting with it simultaneously, then it can handle multiple tests. If it can’t, then the dev has bigger problems.

As for assertions, it’s not that hard to think of a better way to check if you made an insertion or not into the db without writing “assert user_count() == 0”

szundi 2 hours ago | parent | prev [-]

[dead]

2 hours ago | parent | prev [-]
[deleted]