How to write Tests for org.openmrs.module.dhisreport.api.dhis Package ?

I am trying to write test cases for Package org.openmrs.module.dhisreport.api.dhis.

The has methods which need running instance of DHIS2 for the testing.

While installing the module(with command mvn clean install), the user might not have live instance of DHIS2. If we chose DHIS2 instance as, then the problem will occur if user don’t have internet connection.

My question is: Is there any way we can test this package?

My thoughts : If we(Developers) test the package on our own instance of DHIS2 and then ignore the tests later(While launching the module). I am not sure if this is the right way. :stuck_out_tongue:

If anything like this has been done before then the please drop the link.

The correct way is to use request mocking.

EDIT: There are some examples in the OpenMRS Github org of using Mockito.

1 Like