Exemplo n.º 1
0
 def mustfail(self, xml_item):
     mf_type = self.__xml2mf_type(xml_item)
     if mf_type:
         item = BunchResultItem(xml_item)
         mustfail = self.matches(mf_type, item.name())
         result = item.result()
         failed = (result == 'failed')
         return mustfail, failed, result
Exemplo n.º 2
0
 def mustfail(self, xml_item):
     mf_type = self.__xml2mf_type(xml_item)
     if mf_type:
         item = BunchResultItem(xml_item)
         mustfail = self.matches(mf_type, item.name())
         result = item.result()
         failed = (result == 'failed')
         return mustfail, failed, result
Exemplo n.º 3
0
    def success(self, et):
        if et is not None:
            et = et.find('.')
            results = BunchResults(et)
            succeded = True
            if len(results) > 0:
                itself = BunchResultItem(et)
                item_type = itself.get_type()
                if item_type is not None:
                    matches = self.matches(item_type, itself.name())
                    if matches:
                        result = itself.result()
                        if result == 'passed':
                            return False
                        if result == "failed":
                            return True
                #go subitems
                for item_type in MustfailRegistry.ITEM_TYPES:
                    result_map = results.get_by_type(item_type)
                    for xml_item, item_result in result_map.items():
                        item, result = item_result
                        matches = self.matches(item_type, item)
                        if result == 'skipped':
                            #then skip
                            continue
                        if matches:
                            if result == 'passed':
                                return False
                            if result == "failed":
                                return True
                        elif result == 'failed':
                            #look deeper
                            subresults = BunchResults(xml_item)
                            if (not len(subresults) > 0) or (not self.success(xml_item)):
                                return False
                        elif result == 'passed':
                            #look deeper
                            subresults = BunchResults(xml_item)
                            if len(subresults) > 0 and not self.success(xml_item):
                                    return False

            elif et.tag == 'step':
                matches = self.matches(MustfailRegistry.TYPE_STEP, et.find('properties/sentence').text)
                result = et.find('result').text
                if result == 'passed':
                    if matches:
                        return False
                    else:
                        return True
                if result == "failed":
                    if matches:
                        return True
                    else:
                        return False

            return succeded

        return True
Exemplo n.º 4
0
 def mustfail_info(self, xml_item):
     mf_type = self.__xml2mf_type(xml_item)
     if mf_type:
         item = BunchResultItem(xml_item)
         return self.__mf_info(mf_type, item.name())
Exemplo n.º 5
0
    def success(self, et):
        if et is not None:
            et = et.find('.')
            results = BunchResults(et)
            succeded = True
            if len(results) > 0:
                itself = BunchResultItem(et)
                item_type = itself.get_type()
                if item_type is not None:
                    matches = self.matches(item_type, itself.name())
                    if matches:
                        result = itself.result()
                        if result == 'passed':
                            return False
                        if result == "failed":
                            return True
                #go subitems
                for item_type in MustfailRegistry.ITEM_TYPES:
                    result_map = results.get_by_type(item_type)
                    for xml_item, item_result in result_map.items():
                        item, result = item_result
                        matches = self.matches(item_type, item)
                        if result == 'skipped':
                            #then skip
                            continue
                        if matches:
                            if result == 'passed':
                                return False
                            if result == "failed":
                                return True
                        elif result == 'failed':
                            #look deeper
                            subresults = BunchResults(xml_item)
                            if (not len(subresults) > 0) or (
                                    not self.success(xml_item)):
                                return False
                        elif result == 'passed':
                            #look deeper
                            subresults = BunchResults(xml_item)
                            if len(subresults) > 0 and not self.success(
                                    xml_item):
                                return False

            elif et.tag == 'step':
                matches = self.matches(MustfailRegistry.TYPE_STEP,
                                       et.find('properties/sentence').text)
                result = et.find('result').text
                if result == 'passed':
                    if matches:
                        return False
                    else:
                        return True
                if result == "failed":
                    if matches:
                        return True
                    else:
                        return False

            return succeded

        return True
Exemplo n.º 6
0
 def result(self, xml_item):
     return self.success(xml_item), BunchResultItem(xml_item).result()
Exemplo n.º 7
0
 def mustfail_info(self, xml_item):
     mf_type = self.__xml2mf_type(xml_item)
     if mf_type:
         item = BunchResultItem(xml_item)
         return self.__mf_info(mf_type, item.name())