Reputation: 23
I have a service 'S' which has the logic to generate a report and download it. It is written in spring-boot and java. This is consumed by another system 'B' that has the data in its database 'C' that needs to be put into the report.
A button is clicked and the data is queried by 'B' from 'C' and stored in a java pojo class which gets written to a excel file and is stored in cloud. This happens in 'B'
We want to do load testing for 'S' using some dummy data. Can we somehow inject our sample resultset into 'B' when it fires query to its database without making any code changes in 'B'? This sample result-set will then be used to generate the report. (B's jars are attached to 'S')
I was wondering if we can use any testing framework like Mockito, JOOQ, testContainers, since this is not a unit testing scenario or integration testing, to control what goes into the resultset. This is only for load testing purpose and relevant measures will be taken for this to not go to Production.
Please let me know your views.
We can use mockito with scope compile to do the mocking but I am not sure if this or any testing framework is recommended for this case.
Upvotes: 2
Views: 64
Reputation: 221106
I cannot comment on Mockito as I don't know that API. Regarding the other libraries that you asked for:
The jOOQ library includes:
MockingConnection
, where you can mock the JDBC API programmaticallyBoth of these approaches can help with producing dummy result sets for your purpose.
You don't need to use jOOQ in your application to get this to work, as both approaches act as JDBC API implementations.
This will offer a more robust approach to testing than mocking, as you will be able to integration test your code. It will be closer to productive performance characteristics as you can use a real database product inside of a docker container, with all the transactional behaviour etc. It's generally good to use an integration testing approach with databases, although, obviously tests will be quite slower than if using mocks.
Upvotes: 1