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
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 PKG = 'qualification'
00038
00039 import roslib; roslib.load_manifest(PKG)
00040 import rostest, unittest
00041
00042 from qualification.test_loader import load_tests_from_map, load_configs_from_map, load_wg_station_map
00043 from qualification.test import Test
00044
00045 import os, sys
00046
00047
00048 class QualificationTestParser(unittest.TestCase):
00049 def setUp(self):
00050 self.test_files = {}
00051 self.tests_ok = load_tests_from_map(self.test_files)
00052
00053 self.config_files = {}
00054 self.configs_ok = load_configs_from_map(self.config_files)
00055
00056 self.wg_stations = {}
00057 self.wg_stations_ok = load_wg_station_map(self.wg_stations)
00058
00059 def test_wg_station_map(self):
00060 self.assert_(self.wg_stations_ok, "Unable to load WG station map. Configuration file \"wg_map.xml\" is invalid")
00061 self.assert_(len(self.wg_stations.items()) > 0, "No WG stations loaded")
00062
00063
00064 def test_check_tests_parsed(self):
00065 self.assert_(self.tests_ok, "Tests failed to load (tests.xml)")
00066 self.assert_(self.test_files is not None, "Tests list is None, nothing to load")
00067 self.assert_(len(self.test_files.items()) > 0, "No tests loaded")
00068
00069 for sn, tsts in self.test_files.iteritems():
00070 for t in tsts:
00071 self.assert_(t.validate(), "Test failed to validate. Serial number: %s" % sn)
00072
00073
00074 def test_check_configs_parsed(self):
00075 self.assert_(self.configs_ok, "Configs failed to load (configs.xml)")
00076 self.assert_(self.config_files is not None, "Configs list is None, nothing to load")
00077 self.assert_(len(self.config_files.items()) > 0, "No config scripts loaded")
00078
00079 for sn, tsts in self.config_files.iteritems():
00080 for t in tsts:
00081 self.assert_(t.validate(), "Config file failed to validate. Serial number: %s" % sn)
00082
00083 if __name__ == '__main__':
00084 if len(sys.argv) > 1 and sys.argv[1] == '-v':
00085
00086 suite = unittest.TestSuite()
00087 suite.addTest(QualificationTestParser('test_wg_station_map'))
00088 suite.addTest(QualificationTestParser('test_check_tests_parsed'))
00089 suite.addTest(QualificationTestParser('test_check_configs_parsed'))
00090
00091 unittest.TextTestRunner(verbosity = 2).run(suite)
00092 else:
00093 rostest.unitrun(PKG, 'check_test_files', QualificationTestParser)
00094
00095