DEV Community

Discussion on: Write Go unit tests for db CRUD with random data

Collapse
 
objque profile image
Mikhail Kalinin • Edited

Thanks for great article! Just one question: Am I right that tests are creating entities and do not remove they after test is finished? So, that may cause side effects. Better to use setup/teardown or tx+rollback :)

Collapse
 
techschoolguru profile image
TECH SCHOOL

Hi Mikhail, I don't have to setup/teardown in my tests because I use random data. So they won't conflict with each other.

Collapse
 
shayantrix profile image
shayan amirshahkarami

the course is great, I love it.
I have a question about these test parts, if we didn't want our DB to be field with these Random Data (the Data that we don't want to use) so what can we do then ?
TNX a lot my friend ;)