You are viewing a single thread.
View all comments View context
4 points

I don’t get it, how would a database container run your unit tests? And unless you know some secret option to stop the database after, say, it is idle for a few seconds, it will continue running.

The purpose is to test database dependent code by spinning up a real database and run your code against that.

permalink
report
parent
reply
14 points
*

Ah! That’s what I didn’t understand. So its not a container for executing unit tests. Its a container for dependencies to support unit tests. That is not clear from the readme unless I missed something

edit - the title could be “Self terminating containers for real world dependencies to support your unit tests”

permalink
report
parent
reply
11 points

This feels more like an integration test than a unit test to me. Maybe that’s not an important distinction to make, but it feels like it would also help communicate intent.

permalink
report
parent
reply
12 points

I’m reading this scratching my head going “If your unit tests need a database they ain’t a unit test”.

permalink
report
parent
reply
2 points

Thanks man, my brain was short-circuited on Testcontainers so I couldn’t write better. Also I am stealing the title.

permalink
report
parent
reply
1 point

So it’s not for unit tests, that’s where the confusion stems

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 3.1K

    Monthly active users

  • 894

    Posts

  • 7.7K

    Comments