예제 #1
0
파일: suite.py 프로젝트: S41nz/TBTAF
    def getSuiteResult(self):
        '''
        Method to obtain the result of a test suite execution
        '''
        candidateVerdict = TBTAFVerdictType.INCONCLUSIVE
        startTimestamp = datetime.datetime.max
        endTimestamp = datetime.datetime.min
        passTests = 0
        inconclusiveTests = 0
        failedTests = 0

        if self.suiteTestCases is not None:
            
            for suiteTestCase in self.suiteTestCases:
                #Check if the trace is not null
                currentResult = suiteTestCase.getResult()
                
                if currentResult is not None:
                    #Check the test verdict
                    testVerdict = currentResult.getVerdict()
                    if testVerdict == TBTAFVerdictType.INCONCLUSIVE:
                        inconclusiveTests = inconclusiveTests + 1
                    elif testVerdict == TBTAFVerdictType.FAIL:
                        failedTests = failedTests + 1
                    elif testVerdict == TBTAFVerdictType.PASS:
                        passTests = passTests + 1
                    #Calculate the timestamps
                    if currentResult.getStartTimestamp() is not None:
                        if startTimestamp > currentResult.getStartTimestamp():
                            startTimestamp = currentResult.getStartTimestamp()
                            
                    if currentResult.getEndTimestamp() is not None: 
                        if endTimestamp < currentResult.getEndTimestamp():
                            endTimestamp = currentResult.getEndTimestamp()
                    
                else:
                    inconclusiveTests = inconclusiveTests + 1
                    
        #With the gathered data we create the result of the overall suite
        # First the verdict
        if len(self.suiteTestCases) == passTests:
            candidateVerdict = TBTAFVerdictType.PASS
        elif failedTests is not 0:
            candidateVerdict = TBTAFVerdictType.FAIL
        else:
            candidateVerdict = TBTAFVerdictType.INCONCLUSIVE
        
        #Then create the result instance for the suite
        suiteResult = TBTAFResult(candidateVerdict,self.suiteID)
        suiteResult.setStartTimestamp(startTimestamp)
        suiteResult.setEndTimestamp(endTimestamp)
        #Store the summary indicators on the result object
        suiteResult.setInconclusiveTests(inconclusiveTests)
        suiteResult.setFailedTests(failedTests)
        suiteResult.setPassTests(passTests)
        
        return suiteResult
예제 #2
0
파일: smart_suite.py 프로젝트: S41nz/TBTAF
 def getSuiteResult(self,tags,queryFilter=None):
     '''
     Method to obtain the TBTAF result based on a specific set of tags
     '''
     TBTestSuite.getSuiteResult(self)
     #Obtain the test cases based on the tag query
     selectedTestCases = self.getTestCases(tags,queryFilter)
     
     candidateVerdict = TBTAFVerdictType.INCONCLUSIVE
     startTimestamp = datetime.datetime.max
     endTimestamp = datetime.datetime.min
     passTests = 0
     inconclusiveTests = 0
     failedTests = 0
     
     if selectedTestCases is not None and len(selectedTestCases) > 0:
         
         for suiteTestCase in selectedTestCases:
             #Check if the trace is not null
             currentResult = suiteTestCase.getResult()
             
             if currentResult is not None:
                 #Check the test verdict
                 testVerdict = currentResult.getVerdict()
                 if testVerdict == TBTAFVerdictType.INCONCLUSIVE:
                     inconclusiveTests = inconclusiveTests + 1
                 elif testVerdict == TBTAFVerdictType.FAIL:
                     failedTests = failedTests + 1
                 elif testVerdict == TBTAFVerdictType.PASS:
                     passTests = passTests + 1
                 #Calculate the timestamps
                 if currentResult.getStartTimestamp() is not None:
                     if startTimestamp > currentResult.getStartTimestamp():
                         startTimestamp = currentResult.getStartTimestamp()
                     
                 if currentResult.getEndTimestamp() is not None:
                     if endTimestamp < currentResult.getEndTimestamp():
                         endTimestamp = currentResult.getEndTimestamp()
                 
             else:
                 inconclusiveTests = inconclusiveTests + 1
                 
     #With the gathered data we create the result of the overall suite
     # First the verdict
     if len(selectedTestCases) == passTests and len(selectedTestCases) > 0:
         candidateVerdict = TBTAFVerdictType.PASS
     elif failedTests is not 0:
         candidateVerdict = TBTAFVerdictType.FAIL
     else:
         candidateVerdict = TBTAFVerdictType.INCONCLUSIVE
     
     #Then create the result instance for the suite
     suiteResult = TBTAFResult(candidateVerdict,self.suiteID)
     suiteResult.setStartTimestamp(startTimestamp)
     suiteResult.setEndTimestamp(endTimestamp)
     #Set the summary results at the suite level
     suiteResult.setInconclusiveTests(inconclusiveTests)
     suiteResult.setFailedTests(failedTests)
     suiteResult.setPassTests(passTests)
     
     return suiteResult