When the events increases in the mongoDB, then test cases tooks longer time for execution

Hi all,

As my test cases are storing data in MongoDB. When I run these test cases, the execution time for these test cases automatically increases.
Running the First time: took 30 sec (Store around 120 events)
Running the Second time: took 45 sec
Running the Third time: took 1 min… and so on

I tried to resolve it by adding the weakReferenceCache configuration to the aggregate, but it works to some extent. But a few test cases got failed (got passed after re-running).
Also tried snapshot configuration, but didn’t work for me.

Could you suggest a configuration?
(WIthout axon server)

Thank you in advance!

That’s hard to say without having more details. Something you can do is, either at the start or the end of each test, to throw away all the data.

1 Like

Hi @Gerard

Does throwing away all data means emptying the MongoDB?
If it is so, that data loss took place.
Or something different?
Can you suggest me some configurations?

yes, it depends, you might not want to drop the whole collection, maybe just all the documents. That should be fast enough, and you don’t need to create the collection, with possibly some indexes, for each test that way. You can take a look at the recently published article on Baeldung.

1 Like