Need a dbus method to inspect dbus call log

Bug #1099483 reported by Robert Bruce Park on 2013-01-14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Robert Bruce Park

Bug Description

Problem: The only way to confirm that my application has called the correct dbus methods, is to capture STDOUT from dbusmock and analyze it's contents, looking for the right method names and call signatures.

This is fine when your testsuite is written in python and is running inside the same process as dbusmock, you have a lot of control to redirect STDOUT and analyze it.

But this becomes quite a limiting factor when the testsuite is written in a different language: What happens is you call dbus methods in order to set up the mocks, but then your tests are running in a separate process, and it can be difficult to capture that STDOUT.

Obviously you might say "well, just pipe the STDOUT from the python process to the STDIN of your testsuite process and analyze it that way", except that what if we are using dbus-test-runner? testsuite invocation looks like this:

xvfb-run dbus-test-runner --max-wait=0 --task python3 -p -m -p dbusmock -p com.canonical.Friends.Service -p /com/canonical/friends/Service -p com.canonical.Friends.Service --task-name DBusService --ignore-return --task ./test-vala --wait-for com.canonical.Friends.Service --task-name Service

How do you pipe one to the other? I don't think dbus-test-runner supports such a feature ;-)

So it would be better if dbusmock kept a log of the mock calls/signatures that could be queried over dbus directly. I expect this would require two new dbus methods in order to work. One like 'QueryCalls' and one like 'ClearLog'. The idea being that each individual unit test would want to start off with a clean slate (no leaking state between tests), so start by clearing the log, then do something that triggers one or many dbus method calls, then end by calling QueryCalls and check that the expected call signatures are present in the log.

Related branches

Changed in python-dbusmock:
status: New → In Progress
assignee: nobody → Robert Bruce Park (robru)
Martin Pitt (pitti) wrote :
Changed in python-dbusmock:
status: In Progress → Fix Committed
Martin Pitt (pitti) wrote :

I released 0.4.0 with this yesterday.

Changed in python-dbusmock:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers