开发者

distributed unit testing/scenario based unit testing with boost.test

开发者 https://www.devze.com 2023-01-13 14:14 出处:网络
I am developing unit test cases for an application using Boost.test libraries. There are certain 开发者_如何转开发APIs which can directly be tested.

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号