def testWriteToXML(self): "Write the output and validate that it is the same as the test output" self.calc.WriteToXML("test_output.xml") all_props = [self.calc.GetProperties()] all_props.extend([c.GetProperties() for c in self.calc.Children()]) props = XMLHelpers.ReadPropertiesFromFile("test_output.xml") for i, ctrl in enumerate(props): for key, ctrl_value in ctrl.items(): expected_value = all_props[i][key] if "Image" in expected_value.__class__.__name__: expected_value = expected_value.tostring() ctrl_value = ctrl_value.tostring() if isinstance(ctrl_value, (list, tuple)): ctrl_value = list(ctrl_value) expected_value = list(expected_value) self.assertEquals(ctrl_value, expected_value) import os os.unlink("test_output.xml")
def testRunTestsWithReference(self): "Add a ref control, get the bugs and validate that the hande " from pywinauto import controlproperties ref_controls = [controlproperties.ControlProps(ctrl) for ctrl in XMLHelpers.ReadPropertiesFromFile("ref_controls.xml")] bugs = self.calc.RunTests(ref_controls = ref_controls) from pywinauto import tests tests.print_bugs(bugs) from pywinauto.controls.HwndWrapper import HwndWrapper self.assertEquals(True, isinstance(bugs[0][0][0], HwndWrapper))
def testWriteToXML(self): self.calc.WriteToXML("test_output.xml") all_props = [self.calc.GetProperties()] all_props.extend([c.GetProperties() for c in self.calc.Children()]) from pywinauto import XMLHelpers props = XMLHelpers.ReadPropertiesFromFile("test_output.xml") #for i, ctrl in enumerate(props): # for key, value in ctrl.items(): # if isinstance(value, (list, tuple)): # self.assertEquals(list(value), list(all_props[i][key])) # else: # self.assertEquals(value, all_props[i][key]) import os os.unlink("test_output.xml")