Thursday, May 3, 2012

Catching up

Wow, I haven't posted in a long time. Shortly after my last post I had the flu for a week, then I had a job opportunity come up and I spent half a week flying around for interviews. For two weeks after that I was writing docs and doing more research for OVC and I forgot to blog...

So I have some docs up for OVC now explaining how the code works (. I also added to the readme and made additional comments in the code. Hopefully my additions will help the next team that can pick up OVC.

This week and next I hope to add some unit tests to OVC. I'd like to be able to test to make sure the gstreamer interface is working correctly and that the network connection is working. First thing I need to do is figure out how to launch a sugar activity through a unit testing environment. From there it should be easy enough to mock another activity and have it send fake connections.


I had a conversation with Cerlyn from OLPC about unit testing. It seems like this will be more difficult than I thought...

<trose> can anyone point me to a good reference or example for unit testing sugar activities? specifically testing video and network interfaces?
<Cerlyn> trose: As far as Sugar goes, there is no activity specific testing framework I am aware of; I've been begging for one to be made.
<Cerlyn> Sascha Silbe has been working on unit tests for the core Sugar environment on occasion, but as far as I know progress on that front has been going slow
<trose> I'd like for just some way to start up an activity and then send it fake signals like another activity is trying to connect. Then I could make sure the activity responds correctly
<Cerlyn> many tests Silbe's been working on require user involvement to report pass/fail as well :/
<trose> Cerlyn, well that is frustrating...
<trose> how exactly does sugar start up an activity? is there a way to emulate that?
<trose> or is there a way to say like sugar.startActivity() and get a pointer back?
<Cerlyn> You can start an activity within sugar by running "sugar-launch {fully qualified name of activity here; like org.person.trose.myActivity}"
<trose> Cerlyn, okay
<Cerlyn> That probably wraps a DBUS interface to do it
<trose> but that's cmd right? can i get a handle to inspect the activity?
<Cerlyn> Historically having one activity directly launch another is something that hasn't been done; I do not recall the reasons offhand (not a developer; rather QA)
<trose> Cerlyn, hmm
<trose> i could see how that would cause problems
<trose> this would be a training script though
<trose> *testing
<Cerlyn> trose: In theory, being GTK3 based, GTK-supporting test frameworks should work
<Cerlyn> but graphical testing is obviously not unit level

So there isn't a good way to start up a sugar activity and maintain a handle on it. I may be able to hack around this somehow though. Stay tuned...