mercredi 21 janvier 2015

How to mock whether information is sent to another server correctly?

I need to mock test this case:


I have completed a feature in my server(called server1), so that when server1 receives a request with conditionA, it sends metrics information “conditionA:1” to another server2 (the role of server2 is to collect result of all metrics. e.g. if server2 receives “conditionA:1” twice, it will record: “conditionA: 2").


How to unit test my feature using mock so that I know the information is received by server2?


Note I know how to create a mock request which results in conditionA. But I do not know how to unit test whether the metric IS sent to server2 correctly. Any idea?


Aucun commentaire:

Enregistrer un commentaire