New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test execution time growing when multiple entities #201

Closed
Jcamilorada opened this Issue Jul 28, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@Jcamilorada

Jcamilorada commented Jul 28, 2017

Hello guys I have been noting that when adding multiple class to test using assertPojoMethodsForAll execution time grows exponentially. I am testing with 8 entities or dtos and test did not finish after 5 minutes. I had to kill process.

Please see attached sample project.
pojo-test.zip

@sta-szek

This comment has been minimized.

Owner

sta-szek commented Jul 28, 2017

Hi
thanks for reporting, I easily reproduced your bug. This is caused by main testing logic in pojo-tester library.

By default it generates different objects recursively, so if you have a complex dependency tree like in your case:

Entity4 -> Entity3 -> Entity8 (generate once and then cache)
        -> Entity2 -> Entity8 (reuse cache)
                   -> Entity1
                   -> Entity3 (reuse cache)

it will try to satisfy all combinations for those objects so it means it will try to produce 40185026 objects for Entity4 class. And then it will reuse them all in other's class test.

I debugged some first minutes of tests and it showed me:

2017-07-28 22:00:59 DEBUG - Caching 19008 different objects for class jcrada.dto.Entity2 in dejaVu cache
2017-07-28 22:00:59 DEBUG - Reusing 19008 objects from 'dejaVu' cache for class jcrada.dto.Entity2
2017-07-28 22:01:00 DEBUG - Caching 1056 different objects for class jcrada.dto.Entity3 in dejaVu cache
2017-07-28 22:01:00 DEBUG - Reusing 1056 objects from 'dejaVu' cache for class jcrada.dto.Entity3
2017-07-28 22:01:00 DEBUG - Reusing 19008 objects from 'dejaVu' cache for class jcrada.dto.Entity2
2017-07-28 22:01:00 DEBUG - Reusing 1056 objects from 'dejaVu' cache for class jcrada.dto.Entity3
2017-07-28 22:01:40 DEBUG - Reusing 19008 objects from 'dejaVu' cache for class jcrada.dto.Entity2
2017-07-28 22:01:40 DEBUG - Reusing 1056 objects from 'dejaVu' cache for class jcrada.dto.Entity3
2017-07-28 22:02:27 DEBUG - End of generating different objects (size=40185026) for base class jcrada.dto.Entity4(p1,p2,p3) 

I will try to remove that feature (recursively testing) from pojo-tester library in version 1.0.0.

For now everything you can do is to test your entities separately.

@sta-szek

This comment has been minimized.

Owner

sta-szek commented Nov 4, 2017

Thanks to @36893488147419103231 the problem is solved, now you can use .quickly() method when you create your tests. This solution will be provided with 0.7.6 version.

@sta-szek sta-szek closed this Nov 4, 2017

@sta-szek sta-szek modified the milestones: 1.0.0, 0.7.6 Nov 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment