symbian os unit download
Home arrow Community Forum
Symbian OS Unit
Welcome, Guest
Please Login or Register.    Lost Password?
Using symbianOsUnit with async functionality (1 viewing) (1) Guest
This is the forumheader in the basic forum information
Go to bottom Post Reply Favoured: 0
TOPIC: Using symbianOsUnit with async functionality
#19
amey2003 (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Using symbianOsUnit with async functionality 1 Year, 1 Month ago Karma: 0  
HI all,
I am using symbianOsUnit to test my code.If we go by standard way we define our test functions in testheader.h and framework calls these test functions through testDriver.h, collects return values of these test functions.
After that we verify these values using ASSERT statements.
It works well.

But now what if my functionality is async. If we use active objects in our code, how can we retrn values from functions.

As control will pass to RunL, so how can we return from it.

So We can not put verify return values of functions by Assert statments.

can anybody thought of this or is their any support in new version to test async functionality??
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#20
Maze (User)
Fresh Boarder
Posts: 13
graph
User Offline Click here to see the profile of this user
Re:Using symbianOsUnit with async functionality 1 Year ago Karma: 0  
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
 
Report to moderator   Logged Logged  
 
Last Edit: 2009/08/17 09:06 By Maze.
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Who's Online

We have 9 guests online

Login Form






Lost Password?
No account yet? Register