Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import sys
00019 import unittest
00020
00021 import rospy
00022 import rostest
00023
00024 from simple_script_server import *
00025 sss = simple_script_server()
00026
00027 class SayTest(unittest.TestCase):
00028 def __init__(self, *args):
00029 super(SayTest, self).__init__(*args)
00030 rospy.init_node('test_say_test')
00031 self.cb_executed = False
00032
00033 def test_say(self):
00034 as_name = "/sound/say"
00035 self.as_server = actionlib.SimpleActionServer(as_name, SayAction, execute_cb=self.say_cb, auto_start=False)
00036 self.as_server.start()
00037 self.cb_executed = False
00038 handle = sss.say("sound", ["hello"])
00039 if not self.cb_executed:
00040 self.fail('Service Server not called. script server error_code: ' + str(handle.get_error_code()))
00041
00042 def say_cb(self, goal):
00043 self.cb_executed = True
00044 result = SayResult()
00045 self.as_server.set_succeeded(result)
00046
00047 if __name__ == '__main__':
00048 try:
00049 rostest.run('rostest', 'test_say_test', SayTest, sys.argv)
00050 except KeyboardInterrupt, e:
00051 pass
00052 print "exiting"
00053