Changeset 2260

Show
Ignore:
Timestamp:
05/23/07 11:45:06 (2 years ago)
Author:
edunne
Message:

TestCaseManagementPlugin:

this fixes issue 1551. The testscript validation link now checks to see it the file testtemplates.xml exists rather than throwing a nasty exception if it doesn't.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • testcasemanagementplugin/trunk/testManagementPlugin/testScriptValidator.py

    r2240 r2260  
    3030        #req.redirect( query_URL ) 
    3131        tempTestCaseList = [] 
     32        errors = [] 
    3233         
    3334        projTemplates = self.properties.getTemplates(self, req ) 
    34         for name in projTemplates.getTemplateNames() :  
    35             name = name.encode('ascii', 'ignore') 
    36             testIds = projTemplates.getTestsForTemplate( name ) 
    37             if testIds != None :  
    38                 for id in testIds :  
    39                     if id not in tempTestCaseList : 
    40                         tempTestCaseList.append( id ) 
     35        if projTemplates != None :          
     36            for name in projTemplates.getTemplateNames() :  
     37                name = name.encode('ascii', 'ignore') 
     38                testIds = projTemplates.getTestsForTemplate( name ) 
     39                if testIds != None :  
     40                    for id in testIds :  
     41                        if id not in tempTestCaseList : 
     42                            tempTestCaseList.append( id ) 
     43 
     44            allTestcases, errors = self.properties.getTestCases( self, req ) #fetch the testcases... 
     45         
     46            if allTestcases == None :  
     47                return False, None 
    4148             
     49            for testId in tempTestCaseList: 
     50                if testId in allTestcases :  
     51                    continue 
     52                else: 
     53                    errors.append( "The test: " + testId + ", in the testtemplates.xml file cannont be matched with a real test case" ) 
     54        else: 
     55            #ok if no testtemplates file exists we should definately flag that.  However rather than bail we could also still validate  
     56            #the existing testcases to make sure they are well formed. 
     57            allTestcases, errors = self.properties.getTestCases( self, req ) #fetch the testcases... 
    4258             
    43         allTestcases, errors = self.properties.getTestCases( self, req ) #fetch the testcases... 
    44          
    45         if allTestcases == None :  
    46             return False, None 
    47          
    48         for testId in tempTestCaseList: 
    49             if testId in allTestcases :  
    50                 continue 
    51             else: 
    52                 errors.append( "The test: " + testId + ", in the testtemplates.xml file cannont be matched with a real test case" ) 
    53                         
     59            #append the error message saying testtemplates.xml doesn't exist, then exit. 
     60            errors.append( "No file called testtemplates.xml file found.  This is the file necessary for grouping testcases into predefined test scripts...like a smoke test" ) 
     61                 
     62             
    5463        if errors :  
    5564            req.hdf['testcase.run.errormessage'] = errors