Hello,
unfortunately there is no real support for this (yet) in the symbianosunit.
My rewrite was however preparing for those kind of things (running async calls, running in separate threads, ...) but that's not yet done yet (and will take for me quite a while to add it, since I currently do not have time to work on it).
On rather simple solution you could implement is to nest the active scheduler within your test, and wait until you have received your response (or potentially until a timeout and in that case to fail the test) and at this point stop the nested active scheduler. This is basically the principle how (most) dialogs are run in SymbianOS. You can find
here the documentation about the active scheduler. Thus, the code would look something like the following:
| Code: |
void testSomething()
{
startYourAsyncStuff();
// the next call will block
CActiveScheduler::Start();
// we will continue here once we have stopped the nested active scheduler
runSomeAdditionalTests();
}
void asyncCallback()
{
// run only our tests if we are not the timeout
if (!isTimeout())
runSomeTests()
// if this is the last asyncCallback we expect we stop the nested active scheduler, otherwise we wait for the next asyncCallback.
if (wasLastAsyncCallTest() || isTimeout())
CActiveScheduler::Stop();
// you should not call anything after you stopped the active scheduler
}
|
So why is my version of the SymbianOSUnit prepared for those kind of tests? Basically because you can now have different test runners which allows you to also write one that wraps the tests in different ways. However to extend the whole framework to fully support async tests would require more effort. Therefore I would suggest you the above method.
PS: The above description comes without guarantee, since I haven't done it yet, however it should work, but you might have to do some debugging to really get it right.
Good Luck!
Cheers
Maze