Exemplo n.º 1
0
def parse_results(results_xml, insignificant_tests_matter):
    """
    @type results_xml: C{str} 
    @param results_xml: The results xml

    @type insignificant_tests_matter: C{bool} 
    @param insignificant_tests_matter: Flag

    @rtype: C{list} of C{TestrunResult} 
    @return: A list of the Test results that matter

    Parse the Test results xml
    """
    validate_xml(results_xml)
    visitor = ElementTreeVisitor()
    processor = SignificantResultsProcessor(insignificant_tests_matter)
    visitor.add_processor(processor)
    root = ElementTree.fromstring(results_xml)
    visitor.visit(root)
    return processor.all_passed
Exemplo n.º 2
0
 def test_visit(self):
     dirname = os.path.dirname(os.path.abspath(__file__))
     results_file = os.path.join(dirname, "data", "dummy_results_file.xml")
     results_xml = open(results_file, "r").read()
     root = ElementTree.fromstring(results_xml)
     visitor = ElementTreeVisitor()
     processor_stub = ProcessorStub()
     visitor.add_processor(processor_stub)
     visitor.visit(root)
     expected = ["testresults", "suite", "set",
     "case", "step", "expected_result", "return_code", "start", "end", 
     "case", "step", "expected_result", "return_code", "start", "end", 
     "case", "step", "expected_result", "return_code", "start", "end"]
     self.assertEquals(expected, processor_stub.tags)