935 assert step.findtext("./type") == "StifRunCasesTask" |
940 assert step.findtext("./type") == "StifRunCasesTask" |
936 params = step.findall("./parameters/parameter") |
941 params = step.findall("./parameters/parameter") |
937 assert params[0].get("value") == "*" |
942 assert params[0].get("value") == "*" |
938 assert params[1].get("value") == "60" |
943 assert params[1].get("value") == "60" |
939 assert params[2].get("value") == "c:\\testframework\\" + ntpath.basename(self.engine_ini_file) |
944 assert params[2].get("value") == "c:\\testframework\\" + ntpath.basename(self.engine_ini_file) |
|
945 step = steps.next() |
|
946 assert step.findtext("./type") == "StifRunCasesTask" |
|
947 params = step.findall("./parameters/parameter") |
|
948 assert params[0].get("value") == "TESTSCRIPTER" |
|
949 assert params[1].get("value") == "*" |
|
950 assert params[2].get("value") == "60" |
|
951 assert params[3].get("value") == r"e:\testing\conf\file1.cfg" |
|
952 step = steps.next() |
|
953 assert step.findtext("./type") == "StifRunCasesTask" |
|
954 params = step.findall("./parameters/parameter") |
|
955 assert params[0].get("value") == "TESTSCRIPTER" |
|
956 assert params[1].get("value") == "*" |
|
957 assert params[2].get("value") == "60" |
|
958 assert params[3].get("value") == r"e:\testing\conf\file2.cfg" |
940 |
959 |
941 def test_steps_trace_enabled(self): |
960 def test_steps_trace_enabled(self): |
942 """ Test steps trace enabled. """ |
961 """ Test steps trace enabled. """ |
943 xml = self.generate_xml(trace_enabled="True") |
962 xml = self.generate_xml(trace_enabled="True") |
944 steps = iter(xml.findall(".//task")) |
963 steps = iter(xml.findall(".//task")) |
1111 self.src_dst0 = [] |
1130 self.src_dst0 = [] |
1112 self.custom_dir = None |
1131 self.custom_dir = None |
1113 self.custom_files = None |
1132 self.custom_files = None |
1114 self.component_path = None |
1133 self.component_path = None |
1115 self.ctc_run_process_params = None |
1134 self.ctc_run_process_params = None |
1116 |
1135 self.ats_stf_enabled = None |
1117 def generate_xml(self, harness, trace_enabled="False"): |
1136 |
|
1137 def generate_xml(self, harness, trace_enabled="False", tef_test_module=None, ats_stf_enabled="False"): |
1118 """Generates XML""" |
1138 """Generates XML""" |
1119 def files(*paths): |
1139 def files(*paths): |
1120 """generates paths for the files""" |
1140 """generates paths for the files""" |
1121 return [TEST_PATH.joinpath("tsrc", tpath) for tpath in paths] |
1141 return [TEST_PATH.joinpath("tsrc", tpath) for tpath in paths] |
1122 |
1142 |
1123 self.src_dst1 = [] |
1143 self.src_dst1 = [] |
1124 self.data_files = files("data/file1", "data/file2", "data/file3") |
1144 self.data_files = files("data/file1", "data/file2", "data/file3") |
1125 self.config_files = files("conf/file1.cfg", "conf/file2.cfg") |
1145 self.config_files = files("conf/file1.cfg", "conf/file2.cfg") |
1126 self.testmodule_files = files("testmodules/file1.dll", "testmodules/file2.dll") |
1146 self.testmodule_files = files("testmodules/file1.dll", "testmodules/file2.dll") |
1127 self.image_files = files("output/images/file1.fpsx", "output/images/file2.fpsx") |
1147 self.image_files = files("output/images/file1.fpsx", "output/images/file2.fpsx") |
|
1148 if tef_test_module: |
|
1149 TEST_PATH.joinpath(r"tsrc" + os.sep + "init" + os.sep + "TestFramework.ini").write_text( |
|
1150 r""" |
|
1151 # - Sets a device reset module's dll name(Reboot). |
|
1152 # + If Nokia specific reset module is not available or it is not correct one |
|
1153 # StifHWResetStub module may use as a template for user specific reset |
|
1154 # module. |
|
1155 |
|
1156 [Engine_Defaults] |
|
1157 |
|
1158 TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', |
|
1159 'TestCases' or 'FullReport' |
|
1160 |
|
1161 CreateTestReport= YES # Possible values: YES or NO |
|
1162 |
|
1163 TestReportFilePath= C:\LOGS\TestFramework\ |
|
1164 TestReportFileName= TestReport |
|
1165 |
|
1166 TestReportFormat= TXT # Possible values: TXT or HTML |
|
1167 [End_Defaults] |
|
1168 # -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
|
1169 |
|
1170 [New_Module] |
|
1171 ModuleName= teftestmodule |
|
1172 |
|
1173 """) |
|
1174 else: |
|
1175 TEST_PATH.joinpath(r"tsrc" + os.sep + "init" + os.sep + "TestFramework.ini").write_text( |
|
1176 r""" |
|
1177 # - Sets a device reset module's dll name(Reboot). |
|
1178 # + If Nokia specific reset module is not available or it is not correct one |
|
1179 # StifHWResetStub module may use as a template for user specific reset |
|
1180 # module. |
|
1181 |
|
1182 [Engine_Defaults] |
|
1183 |
|
1184 TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', |
|
1185 'TestCases' or 'FullReport' |
|
1186 |
|
1187 CreateTestReport= YES # Possible values: YES or NO |
|
1188 |
|
1189 TestReportFilePath= C:\LOGS\TestFramework\ |
|
1190 TestReportFileName= TestReport |
|
1191 |
|
1192 TestReportFormat= TXT # Possible values: TXT or HTML |
|
1193 [End_Defaults] |
|
1194 # -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
|
1195 |
|
1196 [New_Module] |
|
1197 ModuleName= testscripter |
|
1198 |
|
1199 """) |
|
1200 |
1128 self.engine_ini_file = files("init/TestFramework.ini")[0] |
1201 self.engine_ini_file = files("init/TestFramework.ini")[0] |
1129 self.report_email = "test.receiver@company.com" |
1202 self.report_email = "test.receiver@company.com" |
1130 self.file_store = path("path/to/reports") |
1203 self.file_store = path("path/to/reports") |
1131 self.diamonds_build_url = "http://diamonds.nmp.company.com/diamonds/builds/1234" |
1204 self.diamonds_build_url = "http://diamonds.nmp.company.com/diamonds/builds/1234" |
1132 self.trace_enabled = trace_enabled |
1205 self.trace_enabled = trace_enabled |
1133 self.pmd_files = TEST_FILES["pmd_file"] |
1206 self.pmd_files = TEST_FILES["pmd_file"] |
1134 self.trace_activation_files = files("trace_init/trace_activation_1.xml") |
1207 self.trace_activation_files = files("trace_init/trace_activation_1.xml") |
1135 self.ctc_enabled = "True" |
1208 self.ctc_enabled = "True" |
|
1209 self.ats_stf_enabled = ats_stf_enabled |
1136 self.eunitexerunner_flags = "/E S60AppEnv /R Off" |
1210 self.eunitexerunner_flags = "/E S60AppEnv /R Off" |
1137 self.custom_dir = "custom" |
1211 self.custom_dir = "custom" |
1138 self.custom_files = files("custom/postpostaction.xml", "custom/prepostaction.xml") |
1212 self.custom_files = files("custom/postpostaction.xml", "custom/prepostaction.xml") |
1139 self.component_path = str(TEST_PATH.joinpath("tsrc", "group")) |
1213 self.component_path = str(TEST_PATH.joinpath("tsrc", "group")) |
1140 self.ctc_run_process_params = r"10.0.0.1#x:\ats\drop0.zip#1" |
1214 self.ctc_run_process_params = r"10.0.0.1#x:\ats\drop0.zip#1" |
1182 mocker.expect(test_plan["eunitexerunner_flags"]).result("/E S60AppEnv /R Off") |
1256 mocker.expect(test_plan["eunitexerunner_flags"]).result("/E S60AppEnv /R Off") |
1183 mocker.expect(test_plan["eunitexerunner?flags"]).result(self.eunitexerunner_flags) |
1257 mocker.expect(test_plan["eunitexerunner?flags"]).result(self.eunitexerunner_flags) |
1184 mocker.expect(test_plan["device_hwid"]).result("5425") |
1258 mocker.expect(test_plan["device_hwid"]).result("5425") |
1185 mocker.expect(test_plan["trace_enabled"]).result(self.trace_enabled) |
1259 mocker.expect(test_plan["trace_enabled"]).result(self.trace_enabled) |
1186 mocker.expect(test_plan["ctc_enabled"]).result(self.ctc_enabled) |
1260 mocker.expect(test_plan["ctc_enabled"]).result(self.ctc_enabled) |
|
1261 mocker.expect(test_plan["ats_stf_enabled"]).result(self.ats_stf_enabled) |
1187 mocker.expect(test_plan["custom_dir"]).result("custom1A") |
1262 mocker.expect(test_plan["custom_dir"]).result("custom1A") |
1188 mocker.expect(test_plan.custom_dir).result(path(r"self.custom_dir")) |
1263 mocker.expect(test_plan.custom_dir).result(path(r"self.custom_dir")) |
1189 mocker.expect(test_plan["ctc_run_process_params"]).result(self.ctc_run_process_params) |
1264 mocker.expect(test_plan["ctc_run_process_params"]).result(self.ctc_run_process_params) |
1190 mocker.expect(test_plan["report_email"]).result(self.report_email) |
1265 mocker.expect(test_plan["report_email"]).result(self.report_email) |
1191 mocker.expect(test_plan["report_type"]).result("") |
1266 mocker.expect(test_plan["report_type"]).result("") |
|
1267 mocker.expect(test_plan["file_store"]).result("") |
1192 if self.trace_enabled == "False": |
1268 if self.trace_enabled == "False": |
1193 mocker.expect(test_plan.sets).result([ |
1269 mocker.expect(test_plan.sets).result([ |
1194 dict(name="set0", image_files=self.image_files, data_files=self.data_files, |
1270 dict(name="set0", image_files=self.image_files, data_files=self.data_files, |
1195 config_files=self.config_files, testmodule_files=self.testmodule_files, |
1271 config_files=self.config_files, testmodule_files=self.testmodule_files, |
1196 engine_ini_file=self.engine_ini_file, test_harness=harness0,src_dst=self.src_dst0, |
1272 engine_ini_file=self.engine_ini_file, test_harness=harness0,src_dst=self.src_dst0, |
1312 check_ctc_start(steps) |
1388 check_ctc_start(steps) |
1313 check_log_dir(steps) |
1389 check_log_dir(steps) |
1314 self.check_install_step(steps, "EUNIT", set_count="1") |
1390 self.check_install_step(steps, "EUNIT", set_count="1") |
1315 self.check_run_cases(steps, "EUNIT") |
1391 self.check_run_cases(steps, "EUNIT") |
1316 check_ctc_write(steps) |
1392 check_ctc_write(steps) |
1317 check_ctc_log(steps, "withpkgfiles") |
1393 check_ctc_log(steps) |
1318 check_fetch_logs(steps, "EUNIT") |
1394 check_fetch_logs(steps, "EUNIT") |
1319 else: |
1395 else: |
1320 self.check_install_step(steps, thar) |
1396 self.check_install_step(steps, thar) |
1321 self.check_run_cases(steps, thar) |
1397 self.check_run_cases(steps, thar) |
|
1398 check_ctc_write(steps) |
|
1399 check_ctc_log(steps) |
|
1400 check_fetch_logs(steps, thar) |
|
1401 |
|
1402 def test_case_steps_teftestmodule(self): |
|
1403 """Checks cases in steps in the test.xml file for TEFTESTMODULE""" |
|
1404 test_harness = ["STIF", "EUNIT", "MULTI_HARNESS"] |
|
1405 for thar in test_harness: |
|
1406 xml = self.generate_xml(thar, tef_test_module=True, ats_stf_enabled="True") |
|
1407 #print et.tostring(xml.getroot()) |
|
1408 steps = iter(xml.findall(".//task")) |
|
1409 steps.next() # Flash images |
|
1410 check_ctc_start(steps) |
|
1411 check_log_dir(steps) |
|
1412 if "MULTI_HARNESS" in thar: |
|
1413 self.check_install_step(steps, "STIF") |
|
1414 self.check_run_cases(steps, "STIF", tef_test_module=True, ats_stf_enabled="True") |
|
1415 check_ctc_write(steps) |
|
1416 check_ctc_log(steps) |
|
1417 check_fetch_logs(steps, "STIF") |
|
1418 |
|
1419 steps.next() # Flash images |
|
1420 check_ctc_start(steps) |
|
1421 check_log_dir(steps) |
|
1422 self.check_install_step(steps, "EUNIT", set_count="1") |
|
1423 self.check_run_cases(steps, "EUNIT") |
|
1424 check_ctc_write(steps) |
|
1425 check_ctc_log(steps) |
|
1426 check_fetch_logs(steps, "EUNIT") |
|
1427 else: |
|
1428 self.check_install_step(steps, thar) |
|
1429 self.check_run_cases(steps, thar, tef_test_module=True) |
|
1430 check_ctc_write(steps) |
|
1431 check_ctc_log(steps) |
|
1432 check_fetch_logs(steps, thar) |
|
1433 for thar in test_harness: |
|
1434 xml = self.generate_xml(thar, tef_test_module=True) |
|
1435 #print et.tostring(xml.getroot()) |
|
1436 steps = iter(xml.findall(".//task")) |
|
1437 steps.next() # Flash images |
|
1438 check_ctc_start(steps) |
|
1439 check_log_dir(steps) |
|
1440 if "MULTI_HARNESS" in thar: |
|
1441 self.check_install_step(steps, "STIF") |
|
1442 self.check_run_cases(steps, "STIF", tef_test_module=True) |
|
1443 check_ctc_write(steps) |
|
1444 check_ctc_log(steps) |
|
1445 check_fetch_logs(steps, "STIF") |
|
1446 |
|
1447 steps.next() # Flash images |
|
1448 check_ctc_start(steps) |
|
1449 check_log_dir(steps) |
|
1450 self.check_install_step(steps, "EUNIT", set_count="1") |
|
1451 self.check_run_cases(steps, "EUNIT") |
|
1452 check_ctc_write(steps) |
|
1453 check_ctc_log(steps) |
|
1454 check_fetch_logs(steps, "EUNIT") |
|
1455 else: |
|
1456 self.check_install_step(steps, thar) |
|
1457 self.check_run_cases(steps, thar, tef_test_module=True) |
1322 check_ctc_write(steps) |
1458 check_ctc_write(steps) |
1323 check_ctc_log(steps) |
1459 check_ctc_log(steps) |
1324 check_fetch_logs(steps, thar) |
1460 check_fetch_logs(steps, thar) |
1325 |
1461 |
1326 def check_install_step(self, steps, harness, set_count="0"): |
1462 def check_install_step(self, steps, harness, set_count="0"): |
1346 assert ntpath.dirname(src) == "ATS3Drop\\set" + set_count + '\\' + letter + '\\' + "sys\\bin" |
1482 assert ntpath.dirname(src) == "ATS3Drop\\set" + set_count + '\\' + letter + '\\' + "sys\\bin" |
1347 dst = params[1].get("value") |
1483 dst = params[1].get("value") |
1348 assert ntpath.basename(dst) == filename |
1484 assert ntpath.basename(dst) == filename |
1349 assert ntpath.dirname(dst) == drive + "\\sys\\bin" |
1485 assert ntpath.dirname(dst) == drive + "\\sys\\bin" |
1350 |
1486 |
1351 def check_run_cases(self, steps, harness="STIF"): |
1487 def check_run_cases(self, steps, harness="STIF", tef_test_module=None, ats_stf_enabled="False"): |
1352 """Checks run cases in the test.xml file""" |
1488 """Checks run cases in the test.xml file""" |
1353 step = steps.next() |
1489 step = steps.next() |
1354 if harness == "STIF": |
1490 if harness == "STIF": |
1355 _ = self.engine_ini_file |
1491 _ = self.engine_ini_file |
1356 assert step.findtext("./type") == "StifRunCasesTask" |
1492 assert step.findtext("./type") == "StifRunCasesTask" |
1357 params = step.findall("./parameters/parameter") |
1493 params = step.findall("./parameters/parameter") |
1358 assert params[0].get("value") == "*" |
1494 assert params[0].get("value") == "*" |
1359 assert params[1].get("value") == "60" |
1495 assert params[1].get("value") == "60" |
1360 assert params[2].get("value") == "c:\\sys\\bin\\" + ntpath.basename(self.engine_ini_file) |
1496 assert params[2].get("value") == "c:\\sys\\bin\\" + ntpath.basename(self.engine_ini_file) |
|
1497 step = steps.next() |
|
1498 assert step.findtext("./type") == "StifRunCasesTask" |
|
1499 params = step.findall("./parameters/parameter") |
|
1500 assert params[0].get("value") == "file1.dll" |
|
1501 assert params[1].get("value") == "*" |
|
1502 assert params[2].get("value") == "60" |
|
1503 step = steps.next() |
|
1504 assert step.findtext("./type") == "StifRunCasesTask" |
|
1505 params = step.findall("./parameters/parameter") |
|
1506 assert params[0].get("value") == "file2.dll" |
|
1507 assert params[1].get("value") == "*" |
|
1508 assert params[2].get("value") == "60" |
|
1509 step = steps.next() |
|
1510 assert step.findtext("./type") == "StifRunCasesTask" |
|
1511 params = step.findall("./parameters/parameter") |
|
1512 if tef_test_module: |
|
1513 assert params[0].get("value") == "teftestmodule" |
|
1514 else: |
|
1515 assert params[0].get("value") == "TESTSCRIPTER" |
|
1516 assert params[1].get("value") == "*" |
|
1517 assert params[2].get("value") == "60" |
|
1518 assert params[3].get("value") == r"c:\sys\bin\file1.cfg" |
|
1519 if tef_test_module and ats_stf_enabled.lower() == "true": |
|
1520 assert params[4].get("value") == r"c:\spd_logs\xml\teftestmodule.xml" |
|
1521 |
|
1522 step = steps.next() |
|
1523 assert step.findtext("./type") == "StifRunCasesTask" |
|
1524 params = step.findall("./parameters/parameter") |
|
1525 if tef_test_module: |
|
1526 assert params[0].get("value") == "teftestmodule" |
|
1527 else: |
|
1528 assert params[0].get("value") == "TESTSCRIPTER" |
|
1529 assert params[1].get("value") == "*" |
|
1530 assert params[2].get("value") == "60" |
|
1531 assert params[3].get("value") == r"c:\sys\bin\file2.cfg" |
|
1532 if tef_test_module and ats_stf_enabled.lower() == "true": |
|
1533 assert params[4].get("value") == r"c:\spd_logs\xml\teftestmodule.xml" |
|
1534 |
|
1535 |
1361 elif harness == "EUNIT": |
1536 elif harness == "EUNIT": |
1362 _ = self.testmodule_files[0] |
1537 _ = self.testmodule_files[0] |
1363 assert step.findtext("./type") == "EUnitTask" |
1538 assert step.findtext("./type") == "EUnitTask" |
1364 params = step.findall("./parameters/parameter") |
1539 params = step.findall("./parameters/parameter") |
1365 assert params[0].get("value") == path(r"z:\sys\bin\EUNITEXERUNNER.EXE") |
1540 assert params[0].get("value") == path(r"z:\sys\bin\EUNITEXERUNNER.EXE") |
1567 mocker.expect(test_plan["custom_dir"]).result("CustomC") |
1742 mocker.expect(test_plan["custom_dir"]).result("CustomC") |
1568 mocker.expect(test_plan.custom_dir).result(path(r"self.custom_dir")) |
1743 mocker.expect(test_plan.custom_dir).result(path(r"self.custom_dir")) |
1569 mocker.expect(test_plan["ctc_run_process_params"]).result(self.ctc_run_process_params) |
1744 mocker.expect(test_plan["ctc_run_process_params"]).result(self.ctc_run_process_params) |
1570 mocker.expect(test_plan["report_email"]).result(self.report_email) |
1745 mocker.expect(test_plan["report_email"]).result(self.report_email) |
1571 mocker.expect(test_plan["report_type"]).result("") |
1746 mocker.expect(test_plan["report_type"]).result("") |
|
1747 mocker.expect(test_plan["file_store"]).result("") |
1572 mocker.expect(test_plan.sets).result([ |
1748 mocker.expect(test_plan.sets).result([ |
1573 dict(name="set0", image_files=self.image_files, sis_files=self.sis_files, |
1749 dict(name="set0", image_files=self.image_files, sis_files=self.sis_files, |
1574 engine_ini_file=self.engine_ini_file, test_harness=self.harness, ctc_enabled="False", component_path=self.component_path, custom_dir=None), |
1750 engine_ini_file=self.engine_ini_file, test_harness=self.harness, ctc_enabled="False", component_path=self.component_path, custom_dir=None), |
1575 ]) |
1751 ]) |
1576 mocker.expect(test_plan.post_actions).result([]) |
1752 mocker.expect(test_plan.post_actions).result([]) |
1611 assert step.findtext("./type") == "InstallSisTask" |
1787 assert step.findtext("./type") == "InstallSisTask" |
1612 params = step.findall("./parameters/parameter") |
1788 params = step.findall("./parameters/parameter") |
1613 assert params[-1].get("value") == "c:\\testframework\\" + ntpath.basename(filename) |
1789 assert params[-1].get("value") == "c:\\testframework\\" + ntpath.basename(filename) |
1614 |
1790 |
1615 def test_ats_sut(): |
1791 def test_ats_sut(): |
|
1792 """Test SymbianUnitTest""" |
1616 opts = Bunch(file_store='', flash_images='', diamonds_build_url='', testrun_name='', device_type='', report_email='', test_timeout='', drop_file='', config_file='', target_platform='', data_dir='', build_drive='', sis_files='', harness='', trace_enabled='', specific_pkg='', ats4_enabled='true', device_hwid='') |
1793 opts = Bunch(file_store='', flash_images='', diamonds_build_url='', testrun_name='', device_type='', report_email='', test_timeout='', drop_file='', config_file='', target_platform='', data_dir='', build_drive='', sis_files='', harness='', trace_enabled='', specific_pkg='', ats4_enabled='true', device_hwid='') |
1617 |
1794 |
1618 test_plan = ats3.Ats3TestPlan(opts) |
1795 test_plan = ats3.Ats3TestPlan(opts) |
1619 component_parser = ats3.testconfigurator.Ats3ComponentParser(opts) |
1796 component_parser = ats3.testconfigurator.Ats3ComponentParser(opts) |
1620 |
1797 |