I have developed an android kotlin application. Now I am in the process of creating unit test cases for the application using JUnit and Mockito. This application does not have a UI and runs similarly to a system application. A broadcast is sent to this application which will process the sent data and a response will be broadcasted back to the sent application.
I cannot figure out a way to write a test since this application does not have a return value or an action (like opening an activity).
If it is possible to write a test case in this scenario please mention it. Thank You
There are three types of unit tests:
If you can't test return values, that leaves the other two types. I describe these in this talk: https://youtu.be/Jzlz3Bx-NzM?t=489. And as I describe in the talk, an interaction test is where we get into injecting stubs and spies (I say "mocks" in the talk):
Usually for mobile apps, we are dealing with Requests and Responses communicating with some remote service.