Skip to content

Question: How to approach testing / mocks #356

Answered by brandur
dbhoot asked this question in Q&A
Discussion options

You must be logged in to vote

Do you know of any public projects which test against a real db which I could use to model my own testing approach?

So I was I had a simpler one, but the best I can offer you right now is River's riverinternaltest.

River's internal test suite has two test strategies:

  1. A "test DB manager" which spins up a pool of River databases and then has a manager that selects between them, truncates all tables, and then hands off a database to a particular test that needs one.

  2. Use of a single shared test database along with TestTx. Tests run in a test transaction so changes are automatically rolled back after each one and so no state needs cleaning up.

I'd recommend avoiding (1): River makes us…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@brandur
Comment options

Answer selected by dbhoot
Comment options

You must be logged in to vote
2 replies
@dbhoot
Comment options

@pmenglund
Comment options

Comment options

You must be logged in to vote
1 reply
@Debetux
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #355 on May 16, 2024 08:09.