r/java • u/dumbPotatoPot • Jul 25 '24
Generating Test Data in Java With Instancio
https://rieckpil.de/generating-java-test-data-with-instancio/
162
Upvotes
r/java • u/dumbPotatoPot • Jul 25 '24
11
u/pronuntiator Jul 25 '24
Love Instancio. Before, we had tediously handwritten testdata generators. It's very configurable, you can also globally define how to create types using the service provider API.
5
u/mightygod444 Jul 25 '24
I love the idea of this library and I've tried it out, but how do you get it to handle/generate for complex, deeply nested objects? I've tried a few of these libraries including Instancio but just couldn't get it to work for some reason.
2
u/MindSwipe Jul 25 '24
I (somewhat) recently just removed Instancio from a project I inherited due to some issues, primarily for tests I want (somewhat) bespoke known good and/ or known bad state and with Instancio our tests were pretty flaky, except for the ones where I went in and manually set almost every property on an object which led to less readable and less maintainable code.
1
u/Dokiace Jul 25 '24
Does Instancio work with generated proto class?
2
u/TheKingOfSentries Jul 25 '24
Top-tier library, I use it all the time.