Unit Testing.... a data provider ?

Posted by TomTom on Stack Overflow See other posts from Stack Overflow or by TomTom
Published on 2010-12-29T01:05:14Z Indexed on 2010/12/29 1:54 UTC
Read the original article Hit count: 651

Filed under:

Given problem:

  • I like unit tests.
  • I develop connectivity software to external systems that pretty much and often use a C++ library
  • The return of this systems is nonndeterministic. Data is received while running, but making sure it is all correctly interpreted is hard.

How can I test this properly?

I can run a unit test that does a connect. Sadly, it will then process a life data stream. I can say I run the test for 30 or 60 seconds before disconnecting, but getting code ccoverage is impossible - I simply dont even comeclose to get all code paths EVERY ONCE PER DAY (error code paths are rarely run). I also can not really assert every result. Depending on the time of the day we talk of 20.000 data callbacks per second - all of which are not relly determined good enough to validate each of them for consistency. Mocking? Well, that would leave me testing an empty shell of myself because the code handling the events basically is the to be tested case, and in many cases we talk here of a COMPLEX c level structure - hard to have mocking frameworks that integrate from Csharp to C++

Anyone any idea? I am short on giving up using unit tests for this part of the application.

© Stack Overflow or respective owner

Related posts about unit-testing