views:

41

answers:

1

Hello,

I am developing unit test cases for an application using Boost.test libraries. There are certain APIs which can directly be tested.

But, there are APIs which require interaction between test machines. So for example, execution of a certain API in machine 1 should trigger an API in test machine 2 and its response needs to be used again in machine 1 for successful completion.

How can I synchronize this ? Does Boost provide other libraries for this interaction? If there are any other approaches, kindly suggest them.

Thanks in advance for your time and help.

A: 

There are two kinds of tests you can write for this interaction:

  1. Unit test - using mocks/faks you can fake the calls from the first component and fake the calls from the 2nd component back. This way you can test the internal logic of the first component - for example make sure that if no response were returned a time-out exception is raised.
  2. Integration/acceptance test - create both components as part of the test and configure them and raise the call from component one.

In both kinds of tests you might be required to use events and WaitForSingleObject to make sure that the test won't end before the response has returned.

Dror Helper
Thanks for the reply. I probably will go with the second option.
sprasad