meanbeanlib / meanbean

Automated JavaBean Testing
Apache License 2.0
15 stars 3 forks source link

Default iteration of 100 is too much #2

Open mobasherswl opened 4 years ago

mobasherswl commented 4 years ago

The default testing iteration of 100 is a lot. I don't understand why is that as it just repeatedly runs the same scenario with different random values. I couldn't find a way to set set the iteration easily. Is there a one call for it or passing the whole configuration object, like calling from BeanVerification.

meanbeanlib commented 4 years ago

Here are a couple of ways:

BeanVerification.verifyThat(User.class)
        .with(customizer -> customizer.setDefaultIterations(12))
        .passesAllValidations();

new BeanTesterBuilder()
        .setDefaultIterations(12)
        .build()
        .testBean(User.class);

I debated about lowering the default iteration. One argument in favor is that bean methods should generally be inexpensive such that 100 iterations should still be very quick. If there is slowness when testing a bean, it's a usually sign that the bean is doing some unexpectedly expensive computation in its bean methods.