コード例 #1
0
def validSetAndGetSuiteResult():
    tbTestSuite = TBTestSuite(1,'Sample test 1')
    for i in range(3):
        newTest = TBTAFSampleTest()
        tbTestSuite.addTestCase(newTest)

    temp = tbTestSuite.getSuiteResult()
    
    tbtafExecutionStatus = TBTAFExecutionStatus()
    tbtafExecutionStatus.setSuiteResult(temp)
    result = tbtafExecutionStatus.getSuiteResult()
    if result != temp:
        raise Exception('The value returned is not the same that was set')
コード例 #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