JCON EUROPE 2025
ScheduleSpeakersExhibitors1:1 MeetingsHelp & InformationMentorship HubAgendaRegisterWebsiteBuy a ticket
Report application issue

Session

Login

Modernising J-Unit with Test Data Generators

Due to shorter release cycles, unit test coverage is becoming more important. However, creating realistic and diverse unit test data manually is a tedious job specially as the codebase increases. You have to spend time to add hard coded data for different scenarios. Often duplicate data are found, and tricky edge cases are missed. Static data fixtures are prone to human error. Moreover, when data structure changes the data setup needs to be changed as well which increases maintenance work. Automation is the solution to overcome these limitations. I will show how to generate data with one or a few lines of code with DataFaker, Instancio and Jqwik. With builders and fluent APIs, the code becomes readable and easy to reuse. I will share examples on how to add customisations for specific uses cases like negative amount, locale specific address, date range, list of given size etc. For predictability in tests, I will show examples of reproducing the test failures with seed value. The content will dive deeper into advanced topics like generating valid data based on JSR-380 bean validation, conditional data and benefits of property-based testing. Finally, be it simple and real looking fake data or complex object structures, be it randomness or repetition, for each situation I will explain which library to choose.Level:BeginnerRate - Login requiredShareThursday May 1512:55-13:15atCinema 6
Online