     return callback new Error data.toString()
   return child
 
-startForeign = (name, callback) ->
-  args = foreignParticipants[name]
+startForeign = (commands, name, callback) ->
+  args = commands[name]
   return startProcess args, callback
 
-testParticipant = (state, name) ->
+exports.testParticipant = testParticipant = (state, name) ->
 
   describe "#{name} participant", ->
     participant = null
     beforeEach (done) ->
       @timeout 4000
-      participant = startForeign name, done
+      participant = startForeign state.commands, name, done
     afterEach (done) ->
       participant.kill()
       done()


python = process.env.PYTHON or 'python'
foreignParticipants =
  'PythonRepeat': [python, path.join __dirname, 'fixtures', './repeat.py']
#  'CppRepeat': [python, path.join __dirname, 'fixtures', './repeat-cpp']

startProcess = (args, callback) ->

  afterEach (done) ->
    g.broker.disconnect done

  names = Object.keys state.commands
  names.forEach (name) ->
    testParticipant g, name

