r/softwaretesting • • Jul 15 '26

Testing Java Backend with Random Data Input

Ho everybody. Experienced Java Backend developer here, looking for some advice on testing with random data.

I want to investigate possibilities to execute some stress tests on our Backend and API with datasets that are randomly set up on each test run.

Why? Because the software I am working on has a huge combination of different settings and inputs. Unfortunately we test with static data and thus only some happy paths are executed.

I expect those tests to fail and hopefully deliver some edge cases that we are currently missing on our radar.

Our suite contains mainly unit tests and integration tests (with test container DB)

Does someone have experience and thus some advice with random data tests? Is it worth it or am I expecting too much out of it? Where are the pitfalls and best practices?

Are there any recommended java libraries that help with such a setup?

Thanks

1 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/EarlOfAwesom3 Jul 15 '26 edited Jul 15 '26

Mostly truly random, in regards to the data type.

Imagine an API that sends an object that contains a lot of optional data. There can be null (absence of value), empty or some data accoding to the type.

The goal is to test the backend for resillience against those (random) combinations of possible values.

Sure there might be some rules that say: if A is present, so must B. But that is for the backend to handle.

Maybe as addition: verification of business rules will be hard to impossible, because of randomness. The only verification I can imagine would be: there shall be no internal exception.

1

u/MegaestMan Jul 15 '26

I haven't used it myself, but it looks to me (I did a brief skim, don't take my word for it) like Jazzer (https://github.com/CodeIntelligenceTesting/jazzer) might be what you're looking for, but there seem to be quite a few different fuzzing tools available if Jazzer or it's mutation framework can't provide you with what you're looking for.

I wouldn't say that "no internal exceptions" from your backend systems is necessarily a good way to validate this. For one thing, while exceptions are - by definition - exceptional events, you are attempting to force an exceptional event to see what the system does. Depending on what shows up in the various logs and what ends up in the data store after the fuzzed data is submitted, a lack of internal exceptions might actually be cause for concern.

1

u/EarlOfAwesom3 Jul 15 '26

Thanks I will take a look!