Another complex testing domain we need to care about is network dependent ones. For example to test the chat API's receive method we'd have to actually send in a message from a different chat activity to this one and then test if its working. This isn't a viable approach to test network based triggers. Instead we'd have to mock up the network bits. By that I mean if we have a ChatActivity class that runs the receive method on the "message received" event we'd make a mock class and change the trigger to a manual one.
+
Another complex testing domain we need to care about is network dependent ones. For example to test the chat API's UI, we'd have to send in a few messages and check if they are displayed. To invoke the receive method we'd have to actually send in a message from a different chat activity to this one and then test if its working. This isn't a viable approach to test network based triggers. Instead we'd have to mock up the network bits. By that I mean if we have a ChatActivity class that runs the receive method on the "message received" event we'd make a mock class and change the trigger to a manual one. Just run the receive method with some test/dummy data and check if the UI is updated accordingly.
To further explain my approach I'd like to take an example from the Chat Activity. In the chat activity class:
To further explain my approach I'd like to take an example from the Chat Activity. In the chat activity class: