Changeset 3704

Show
Ignore:
Timestamp:
05/21/08 00:18:46 (4 months ago)
Author:
edunne
Message:

ok this is the genshi and 0.11rc1 compatible beta

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • testcasemanagementplugin/branches/testManagmentPluginGenshi/setup.py

    r2370 r3704  
    1 from setuptools import setup, find_packages 
    2 #setup( 
    3 #    name = "sprintReports", 
    4 #    version = "0.1", 
    5 #    packages = find_packages(), 
    6 #) 
    7  
    8  
    9 from setuptools import setup, find_packages 
    10  
    11 PACKAGE = 'testManagementPlugin' 
    12 VERSION = '0.4.0' 
     1from setuptools import find_packages, setup 
    132 
    143setup( 
    15     name=PACKAGE, version=VERSION, 
    16     description='test case management tool', 
    17     author="Eoin Dunne", author_email="eoin.dunne@divestco.com", 
     4    name='testManagementPlugin', version='0.11.1', 
     5    author="Eoin Dunne", author_email="edunnesoftwaretesting@hotmail.com", 
    186    license='BSD', url='http://www.trac-hacks.org/wiki/TestCaseManagementPlugin', 
    197    packages=['testManagementPlugin'], 
     
    219        'testManagementPlugin': [ 
    2210            'htdocs/css/*.css', 
    23             'templates/*.cs', 
     11            'templates/*.html', 
    2412            'htdocs/img/*.png', 
    2513            'htdocs/js/*.js' 
     
    3018         'testManagement=testManagementPlugin.testManager', 
    3119         'manageTestRuns=testManagementPlugin.testRuns', 
     20         'testRunResults=testManagementPlugin.testResults', 
    3221         'setPathForTestcases=testManagementPlugin.pathManager', 
    33          'testRunResults=testManagementPlugin.testResults', 
    3422         'validateTestRun=testManagementPlugin.testScriptValidator' 
    3523        ] 
    3624    }, 
    3725) 
    38  
    39  
    40 #package_data={ 
    41     #    'webadmin': [ 
    42     #        'htdocs/css/*.css', 
    43     #        'htdocs/img/*.png', 
    44     #        'htdocs/js/*.js', 
    45     #        'templates/*.cs' 
    46     #    ] 
    47     #}, 
    48     #entry_points = { 
    49     #    'trac.plugins': [ 
    50     #        'webadmin.web_ui = webadmin.web_ui', 
    51     #        'webadmin.basics = webadmin.basics', 
    52     #        'webadmin.logging = webadmin.logging', 
    53     #        'webadmin.perm = webadmin.perm', 
    54     #        'webadmin.plugin = webadmin.plugin', 
    55     #        'webadmin.ticket = webadmin.ticket' 
    56     #    ] 
    5726     
  • testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/pathManager.py

    r2283 r3704  
    2323    properties = Properties() #get set up with with a properties instance... 
    2424         
    25     def process_testmanager_request(self, req ): 
     25    def process_testmanager_request(self, req, data=None ): 
    2626        if req.method == "POST": 
    2727 
     
    2929             
    3030            if errors : 
    31                 req.hdf['testcase.run.errormessage'] = errors 
    32                 return "testRunNotConfigured.cs", None       
     31                data["errorMessage"] = "error fetching test case list" 
     32                data["errorsList"] = errors 
     33                return "testRunNotConfigured.html", data, None       
    3334            else :  
    3435                 req.redirect( req.base_url + "/testmanagement/runs?pathConfiguration=" + self.properties.getTestCasePath( self, req) ) 
    3536 
    3637        else: 
    37             req.hdf['testcases.path.path'] = self.properties.getTestCasePath( self, req) 
    38             return "choosePathForTestRun.cs", None 
     38            data['pathManager_path'] = self.properties.getTestCasePath( self, req) 
     39            return "choosePathForTestRun.html", data, None 
    3940 
    4041    def get_path( self, req ): 
  • testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/properties.py

    r2341 r3704  
     1#Author:   Eoin Dunne 
     2#email:   edunnesoftwaretesting@hotmail.com 
     3#May 2008 
     4# 
     5# 
     6#Thanks to the guys at TRAC and the author of the TRAC admin tool.  The main controller is based on your design. 
     7# 
     8#Long live open source! 
     9 
    110import re 
    211 
     
    3746         
    3847    def hasTestCases(self, component, req ): 
    39         #check to see if the path to the testcases has been specified for this component in this project. 
    40               
    41         testcasePath = self.getTestCasePath( component, req ) 
    42         repository = self.getRepository( component, req ) 
    43          
    44         #return repository.has_node( testcasePath ), testcasePath   
    45         return True, testcasePath 
    46              
     48        try:  
     49            #check to see if the path to the testcases has been specified for this component in this project. 
     50                  
     51            testcasePath = self.getTestCasePath( component, req ) 
     52            repository = self.getRepository( component, req ) 
     53             
     54            #return repository.has_node( testcasePath ), testcasePath   
     55            return True, testcasePath, None 
     56             
     57        except Exception, ex:  
     58            return FALSE, testcasePath, str( ex )     
     59         
    4760    def getTestCasePath(self, component, req): 
    4861        #potentially a user wants to use the branch for testcases so check that first 
     
    89102                    try: 
    90103                        content = entry.get_content().read() 
    91                         testcase = TestCase( entry.get_name(), str(content), component
     104                        testcase = TestCase( entry.get_name(), str(content), component, entry.get_name()
    92105                        testcases[ testcase.getId().encode('ascii', 'ignore').strip() ] =  testcase  
     106                     
    93107                    except Exception, ex: 
    94                         errors.append( "The testcsae  :" + entry.get_name() + "  is not well formed xml...a parse error occured " ) 
    95                         component.env.log.debug( "The testcsae  :" + entry.get_name() + "  is not well formed xml...a parse error occured " ) 
    96                          
     108                        errors.append( "The testcase  :" + entry.get_name() + "  is not well formed xml...a parse error occured " ) 
    97109                         
    98110        #first let's do some validation on the testcases... 
     
    100112        currentTestcase = None 
    101113        component.env.log.debug( "testcases length is : " + repr( len( testcases ) ) ) 
    102         try: 
    103             for key, value in testcases.iteritems(): 
    104                 currentTestcase = value #incase we do toss an exception I'll want some information from this testcase 
    105                 components.index( value.getComponent().encode('ascii', 'ignore').strip() ) #this will toss an exception if the component in the testcase doesn't exist in the trac project 
    106         except Exception, ex: 
    107             errors.append( "The component :" + currentTestcase.getComponent() + ", in the testcase : " + currentTestcase.getId() + ", does not exist in the trac project "  ) 
    108             component.env.log.debug( "The component :" + currentTestcase.getComponent() + ", in the testcase : " + currentTestcase.getId() + ", does not exist in the trac project "  ) 
    109              
    110         component.env.log.debug( "testcases length is : " + repr( len( testcases ) ) ) 
    111  
     114        for key, value in testcases.iteritems(): 
     115            try: 
     116                    currentTestcase = value #in case we do toss an exception I'll want some information from this testcase 
     117                    components.index( value.getComponent().encode('ascii', 'ignore').strip() ) #this will toss an exception if the component in the testcase doesn't exist in the trac project 
     118                     
     119            except Exception, ex: 
     120                errors.append( "The component :" + currentTestcase.getComponent() + ", in the testcase : " + currentTestcase.getId() + "  in the file : " + currentTestcase.getFileName() + ", does not exist in the trac project "  ) 
     121                 
     122                 
    112123        return testcases, errors #ok return the testcases 
    113124         
     
    172183                 
    173184                #append the error message saying testtemplates.xml doesn't exist, then exit. 
    174                 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" ) 
     185                errors.append( "No file called testtemplates.xml file found.  This is the file necessary for grouping testcases into predefined test scripts even if it is just a stub (i.e) one template name and one testid..." ) 
    175186                 
    176187        except Exception, ex: 
     
    181192         
    182193         
     194    def trimOutAnyProblemStrings( self, input ): 
     195        #trim out any characters/strings that could cause issues in the sql statement.  I should just escape them but for now this is a quick hack 
     196        #this method doesn't really belong here.  But I jammed it in because I'm a little rushed.  Probably should dump it into a seperate python util file. 
     197         
     198        #make sure input is a real string 
     199        if not (input) : 
     200            return input 
     201        input = input.replace('\'', '-') #replace anything that will cause issues in the sql statement 
     202        input = input.replace(',', '-') #replace anything that will cause issues in the sql statement 
     203        input = input.replace('"', '-') #replace anything that will cause issues in the sql statement 
     204        input = input.replace('&', '-') #replace anything that will cause issues in the sql statement 
     205        input = input.replace('%', '-') #replace anything that will cause issues in the sql statement 
     206        input = input.replace('delete', '-') #replace anything that will cause issues in the sql statement 
     207        input = input.replace('drop', '-') #replace anything that will cause issues in the sql statement 
     208        input = input.replace('insert', '-') #replace anything that will cause issues in the sql statement 
     209         
     210        return input 
     211             
    183212class Templates: 
    184213     
     
    220249class TestCase : 
    221250    #accessor methods for private properties 
     251    def getFileName(self) : 
     252        return self.fileName 
     253     
    222254    def getId(self) :  
    223255        return self.id.encode('ascii', 'ignore').strip() 
     
    235267        return self.expectedresult 
    236268         
    237     def __init__(self, testcasename, testCaseContent, component ) :  
     269    def __init__(self, testcasename, testCaseContent, component, fileName = None ) :  
    238270        self.id = "" 
    239271        self.summary = "" 
     
    241273        self.expectedresult = "" 
    242274        self.component = "" 
     275        self.fileName = "" 
     276         
     277        self.fileName = fileName 
    243278 
    244279        attributesList = ['id', 'summary','description','expectedresult', 'component'] 
  • testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/testManager.py

    r2041 r3704  
    1 #!/usr/bin/env python 
     1#Author:   Eoin Dunne 
     2#email:   edunnesoftwaretesting@hotmail.com 
     3#May 2008 
     4
     5
     6#Thanks to the guys at TRAC and the author of the TRAC admin tool.  The main controller is based on your design. 
     7
     8#Long live open source! 
    29 
    310import re 
     
    1118from trac.core import * 
    1219from trac.ticket import Milestone, Ticket, TicketSystem 
     20from trac.util.html import html 
    1321from trac.web import IRequestHandler 
    14 from trac.util import Markup 
    15 from trac.web.chrome import INavigationContributor 
    16 from trac.web.chrome import add_stylesheet, INavigationContributor, ITemplateProvider 
    17 #from trac.web.href import Href 
    18 #from trac.wiki import wiki_to_html 
     22from trac.web.chrome import INavigationContributor, ITemplateProvider, add_stylesheet 
    1923 
    20 #env: The environment, an instance of the trac.env.Environment class (see trac.env).  
    21 #config: The configuration, an instance of the trac.config.Configuration class (see trac.config).  
    22 #log: The configured logger, see the Python logging API for more information.  
    23  
    24 #TRAC_PATH = _find_base_path(sys.modules['trac.core'].__file__, 'trac.core') 
    25  
    26 def main( argv ) : 
    27     """ 
    28      
    29     """ 
    30     print "main" 
    3124 
    3225 
     
    3932        """ 
    4033 
    41     def process_testmanager_request(self, req ): 
     34    def process_testmanager_request(self, req, data=None ): 
    4235        """ 
    4336        """ 
     
    4538        """ 
    4639        """ 
    47  
    48 class TestManager(Component): 
    49     implements(INavigationContributor, IRequestHandler, ITemplateProvider
     40  
     41class TestManager (Component): 
     42    implements(INavigationContributor, IRequestHandler, ITemplateProvider
    5043     
    5144    #class variable...a collection of objects that implement the ITestManagerRequestHandler interface.  Makes it's super easty to extend... 
    5245    page_providers = ExtensionPoint(ITestManagerRequestHandler) 
     46     
     47    def __init__(self) : 
     48        #in here we could do stuff. 
     49        pass 
    5350         
     51     
    5452    # INavigationContributor methods 
    5553    def get_active_navigation_item(self, req): 
    5654        return 'testmanagement' 
    5755         
    58     #This is for trac to Add sprint to the tabbed header. 
    5956    def get_navigation_items(self, req): 
    60         yield ('mainnav', 'testmanagement', Markup('<a href="%s">TestManagement</a>', self.env.href.testmanagement() + '/' ) ) 
    61  
     57        yield ('mainnav', 'TestManagement', 
     58            html.A('TestManagement', href= req.href.testmanagement())) 
    6259 
    6360    # IRequestHandler methods 
    64     #let's figure out if we are the one that should care about this request. 
    6561    def match_request(self, req): 
    6662        match = re.match('/testmanagement*', req.path_info) 
    6763        return match  
    68  
    69     #main entry point into this class.  This is a required method of the IRequestHandler interface, which is part of the trac framework. 
     64     
    7065    def process_request(self, req): 
    7166         
    72         add_stylesheet(req, 'testmanagement/css/testcase.css') 
     67         
     68        action = req.args.get('action', 'view') 
     69        pagename = req.args.get('page', 'WikiStart') 
     70        version = req.args.get('version') 
     71        data = { "testcase_page_content" : "select option from above list"  } 
     72         
     73        if pagename.endswith('/'): 
     74            req.redirect(req.href.wiki(pagename.strip('/'))) 
     75                
    7376        pageProvider = self.getPageProvider(req) 
    7477         
     
    7780            page_providers_paths[ provider.get_path(req) ] = { 'name': provider.get_descriptive_name(), 'path': req.base_url + "/testmanagement/" + provider.get_path(req) } 
    7881     
    79         req.hdf['testcase.page_providers_paths'] = page_providers_paths 
     82        data["handlers"] = page_providers_paths 
     83                 
     84        if pageProvider :  
     85            template, data, content_type = pageProvider.process_testmanager_request( req, data ) 
     86            return template, data, content_type 
     87            #return 'testManagement.cs',  content_type #content_type probably = none which is by default rendered as MIME type text/html 
    8088         
    81         if pageProvider :  
    82             template, content_type = pageProvider.process_testmanager_request( req ) 
    83             req.hdf['testcase.page_template'] = template 
    84             return 'testManagement.cs',  content_type #content_type probably = none which is by default rendered as MIME type text/html 
    85         else : 
    86             req.hdf['testcase.page_content'] = "select option from above list"  #you could insert a message here if you wanted... 
    87                        
    88         return 'testManagement.cs', None #content_type probably = none which is by default rendered as MIME type text/html 
    89         
     89         
     90        # This tuple is for Genshi (template_name, data, content_type) 
     91        # Without data the trac layout will not appear. 
     92        return 'main.html', data, None 
    9093     
     94    # ITemplateProvider methods 
     95    # Used to add the plugin's templates and htdocs  
     96    def get_templates_dirs(self): 
     97        from pkg_resources import resource_filename 
     98        return [resource_filename(__name__, 'templates')] 
     99 
     100    def get_htdocs_dirs(self): 
     101        """Return a list of directories with static resources (such as style 
     102        sheets, images, etc.) 
     103 
     104        Each item in the list must be a `(prefix, abspath)` tuple. The 
     105        `prefix` part defines the path in the URL that requests to these 
     106        resources are prefixed with. 
     107 
     108        The `abspath` is the absolute path to the directory containing the 
     109        resources on the local file system. 
     110        """ 
     111        from pkg_resources import resource_filename 
     112        return [('hw', resource_filename(__name__, 'htdocs'))] 
     113 
     114 
    91115    def getPageProvider(self, req): 
    92116        """Find the page provider if any""" 
    93117 
     118        self.env.log.info( "PATH INFO : " + repr( req.path_info ) ) 
    94119        for provider in self.page_providers: 
     120            self.env.log.info( "Provider name : " + repr(provider) ) 
    95121            if re.match('/testmanagement/' + provider.get_path(req), req.path_info) : 
    96                 self.env.log.debug( "found provider : " + repr(provider.get_path(req) ) ) 
     122                self.env.log.info( "found provider : " + repr(provider.get_path(req) ) ) 
    97123                return provider 
    98124         
    99125        return None 
    100          
    101  
    102     # ITemplateProvider 
    103  
    104     def get_htdocs_dirs(self): 
    105         """Return the absolute path of a directory containing additional 
    106         static resources (such as images, style sheets, etc). 
    107         """ 
    108         from pkg_resources import resource_filename 
    109         return [('testmanagement', resource_filename(__name__, 'htdocs'))] 
    110  
    111     def get_templates_dirs(self): 
    112         """Return the absolute path of the directory containing the provided 
    113         ClearSilver templates. 
    114         """ 
    115         from pkg_resources import resource_filename 
    116         return [resource_filename(__name__, 'templates')] 
    117  
    118 if __name__ == '__main__': 
    119     sys.exit( main( sys.argv ) ) 
  • testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/testResults.py

    r1982 r3704  
    2121    implements(ITestManagerRequestHandler) 
    2222     
    23     def process_testmanager_request(self, req ): 
     23    def process_testmanager_request(self, req, data=None ): 
    2424        #for now let's just re-direct to a query page that shows all open testcases grouped by owner and ordered by milestone  
    2525        query_URL = req.base_url + "/query?status=new&status=assigned&status=reopened&testcase_result=&type=testcase&order=milestone&group=owner" 
  • testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/testRuns.py

    r2283 r3704  
    1 #!/usr/bin/env python 
     1#Author:   Eoin Dunne 
     2#email:   edunnesoftwaretesting@hotmail.com 
     3#May 2008 
     4
     5
     6#Thanks to the guys at TRAC and the author of the TRAC admin tool.  The main controller is based on your design. 
     7
     8#Long live open source! 
     9 
    210 
    311import re 
     
    3442    properties = Properties() #get set up with with a properties instance... 
    3543     
    36     def process_testmanager_request(self, req): 
    37          
    38         req.hdf['testcase.run.basepath'] = req.base_url   
    39          
    40         hasTestCases, path = self.properties.hasTestCases( self, req ) 
     44    def process_testmanager_request(self, req, data ): 
     45        hasTestCases, testCaseSVNpath, errors = self.properties.hasTestCases( self, req ) 
     46        data["hasTestCases"] = hasTestCases 
     47        data["testrun_svn_path"] =  testCaseSVNpath 
    4148         
    4249        if hasTestCases : 
     
    5158                 
    5259                else: 
    53                     req.hdf['testcase.run.errormessage'] = errorMessage_orQueryURL 
    54                     req.hdf['testcase.run.pathConfiguration'] = self.properties.getTestCasePath(self, req) 
    55                     req.hdf['testcase.run.urlPath'] = req.base_url + "/testmanagement/runs?pathConfiguration=" + self.properties.getTestCasePath(self, req) 
    56                     return "testRunNotConfigured.cs", None 
    57                  
    58             else : 
     60                     
     61                    data["errorMessage"] = errorMessage_orQueryURL  
     62                    return "testRunNotConfigured.html", data, None 
     63                 
     64            elif errors != None : 
     65                self.env.log.info( "ARG!") 
     66                data["errorMessage"] = errors 
     67                return template, data, content_type 
     68                 
     69            else:  
    5970                # Show Test Run Generation Form: allows a manager to assign testruns to QA staff. 
    60                 return self.provideDefaultCreateTestRunPage( req ) 
    61              
     71                self.env.log.info( "it wasn't a post....so we know where we are....trying to generate the default page" ) 
     72                template, data, content_type = self.provideDefaultCreateTestRunPage( req, data ) 
     73                return template, data, content_type 
     74                 
    6275        else: 
     76            return "testRunNotConfigured.html", data, None 
    6377            #handle when we don't have any test cases...for whatever reason.... 
    64             req.hdf['testcase.run.errormessage'] = "Path in config file is does not exist in subversion...resolved path was: " + path 
    65             return "testRunNotConfigured.cs", None 
    66              
    67  
     78            #req.hdf['testcase.run.errormessage'] = "Path in config file is does not exist in subversion...resolved path was: " + path 
     79            #return "testRunNotConfigured.cs", None 
     80             
     81        return "testrun.html", data, None 
     82         
     83    def get_path( self, req ): 
     84        return "runs" 
     85     
     86    def get_descriptive_name(self): 
     87        return "Create Test Run from main line" 
     88     
     89     
     90    def provideDefaultCreateTestRunPage( self, req, data ) :  
     91        """ 
     92            this method will retrive a list of users, milestones, versions, testcases, and test templates. 
     93            Test case information and test template information comes from subversion while version and user information comes from TRAC. 
     94         
     95        """ 
     96        testcaseNames = [] 
     97        testcaseTemplates = [] 
     98         
     99        #ok now let's extract out of testcases what we need which is mostly testcase ids and template names.. 
     100         
     101        testcases, errors = self.properties.getTestCases( self, req ) #fetch the testcases... 
     102 
     103        self.env.log.info( "TESTCASES" + repr(testcases) + " ERRORS : " + repr(errors) ) 
     104         
     105        if testcases == None or len(errors) > 0 :  
     106            data["errorMessage"] = "No test cases found or other error...see list below if any" 
     107            data["errorsList"] = errors 
     108            return "testRunNotConfigured.html", data, None 
     109             
     110        for key, testcase in testcases.iteritems(): 
     111            testcaseNames.append( testcase.getId() ) 
     112        testcaseNames.sort() 
     113                 
     114        templates = self.properties.getTemplates(self, req ) 
     115        templateNames = [] 
     116        if templates != None :  
     117            templateNames = templates.getTemplateNames() 
     118         
     119        milestones = self.properties.getMilestones(self, req ) 
     120        milestones.append("")   #this is so there is a blank in the drop down select...default is none... 
     121        versions = self.properties.getVersions(self, req ) 
     122        versions.append("")  #ditto 
     123         
     124        self.env.log.info( "KNOWN USERS : " + repr ( self.properties.getKnownUserNamesOnly(self, req) ) ) 
     125         
     126        data['testrun_users'] = self.properties.getKnownUserNamesOnly(self, req) 
     127        data['testrun_testcases'] = testcaseNames 
     128        data['testrun_testtemplates'] = templateNames 
     129        data['testrun_versions'] = versions 
     130        data['testrun_milestones'] =  milestones 
     131        data['testrun_validatePath'] = req.base_url + "/testmanagement/validate?pathConfiguration=" + self.properties.getTestCasePath(self, req) 
     132                 
     133        return "testrun.html", data, None 
     134         
    68135    def generateTracTickets( self, req ) : 
    69136        """ 
     
    81148         
    82149        #grab the parameters that we care about out of the request object 
    83         testRunDescription = str( req.args.get('testrundescription') ) 
    84         users = req.args.get('users') 
    85         testTemplates = req.args.get('testtemplates') 
    86         testcases = req.args.get('testcases') 
    87         version = str( req.args.get('selectedversion')) 
    88         milestone = str( req.args.get('selectedmilestone')) 
    89         testConfiguration = str( req.args.get('testconfiguration')) 
     150        testRunKeyWord = str( req.args.get('testrun_keyword') ) 
     151        users = req.args.get('testrun_users') 
     152        testTemplates = req.args.get('testrun_selectedtemplates') 
     153        testcases = req.args.get('testrun_selectedtestcases') 
     154        version = str( req.args.get('testrun_selectedversion')) 
     155        milestone = str( req.args.get('testrun_selectedmilestone')) 
     156        testConfiguration = str( req.args.get('testrun_testconfiguration')) 
    90157         
    91158        #-----------------------------------ERROR CHECKING ON PARAMETERS-------------------------------------------- 
    92159        #it might make sense to create a new method to validate the parameters passed in but for now we'll leave it. 
     160         
     161        if testRunKeyWord == None :  
     162            testRunKeyWord = "" 
     163        testRunKeyWord = self.properties.trimOutAnyProblemStrings(testRunKeyWord)  #this is manually typed in...so it's probably to look for sqlInjection etc... 
    93164         
    94165        if version == None: 
     
    126197            if testTemplates == None : 
    127198                return False, "must select at least one testcase or test template to create a test run" 
    128                 return 'errorCreatingTestRun.cs', None 
     199     
    129200        elif testTemplates == None : 
    130201            testTemplates = [] 
     
    175246                    ticket.values['version'] = version 
    176247                    ticket.values['milestone'] = milestone 
    177                     ticket.values['keywords'] = "Test_ver" + version + "_mile_" + milestone 
     248                    ticket.values['keywords'] = testRunKeyWord   
    178249                    #self._validate_ticket(req, ticket)   #probably should validate the ticket here. 
    179250                    ticket.insert(db=db) 
     
    189260         
    190261        #redirect to a custom query report showing the created tickets 
    191         return True, req.base_url + "/query?status=new&status=assigned&status=reopened&testcase_result=&version=" + version + "&milestone=" + milestone + "&type=testcase&order=priority&group=owner" 
     262        return True, req.base_url + "/query?status=new&status=assigned&status=reopened&status=accepted&testcase_result=&version=" + version + "&milestone=" + milestone + "&type=testcase&order=priority&group=owner" 
    192263 
    193264    def createCombinedTestCaseList( self, testTemplates, testcases, req ) : 
     
    200271            for name in testTemplates :  
    201272                name = name.encode('ascii', 'ignore') 
     273                name  = self.properties.trimOutAnyProblemStrings(name ) 
    202274                testIds = projTemplates.getTestsForTemplate( name ) 
    203275                if testIds != None :  
     
    213285             
    214286            return tempTestCaseList 
    215          
    216     def provideDefaultCreateTestRunPage( self, req ) :  
    217         """ 
    218             this method will retrive a list of users, milestones, versions, testcases, and test templates. 
    219             Test case information and test template information comes from subversion while version and user information comes from TRAC. 
    220          
    221         """ 
    222         testcaseNames = [] 
    223         testcaseTemplates = [] 
    224          
    225         #ok now let's extract out of testcases what we need which is mostly testcase ids and template names.. 
    226          
    227         testcases, errors = self.properties.getTestCases( self, req ) #fetch the testcases... 
    228          
    229         if testcases == None or errors :  
    230             #there was an error of some kind fetching the testcases...     
    231             req.hdf['testcase.run.errormessage'] = errors 
    232                      
    233             return "testRunNotConfigured.cs", None  
    234              
    235         for key, testcase in testcases.iteritems(): 
    236             testcaseNames.append( testcase.getId() ) 
    237         testcaseNames.sort() 
    238                  
    239         templates = self.properties.getTemplates(self, req ) 
    240         templateNames = [] 
    241         if templates != None :  
    242             templateNames = templates.getTemplateNames() 
    243          
    244         sprints = self.properties.getMilestones(self, req ) 
    245         sprints.append("")   #this is so there is a blank in the drop down select...default is none... 
    246         versions = self.properties.getVersions(self, req ) 
    247         versions.append("")  #ditto 
    248          
    249         req.hdf['testcase.run.validatePath'] = req.base_url + "/testmanagement/validate?pathConfiguration=" + self.properties.getTestCasePath(self, req) 
    250         req.hdf['testcase.run.pathConfiguration'] = self.properties.getTestCasePath(self, req) 
    251         req.hdf['testcase.run.users']= self.properties.getKnownUserNamesOnly(self, req) 
    252         req.hdf['testcase.run.testcases']= testcaseNames 
    253         req.hdf['testcase.run.testtemplates']= templateNames 
    254         req.hdf['testcase.run.sprints']= sprints 
    255         req.hdf['testcase.run.versions']= versions 
    256                  
    257         return 'testRuns.cs', None 
    258          
    259  
    260     def get_path( self, req ): 
    261         return "runs" 
    262      
    263     def get_descriptive_name(self): 
    264         return "Create Test Run from mainline" 
     287    
  • testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/testScriptValidator.py

    r2325 r3704  
    1 #!/usr/bin/env python 
     1#Author:   Eoin Dunne 
     2#email:   edunnesoftwaretesting@hotmail.com 
     3#May 2008 
     4
     5
     6#Thanks to the guys at TRAC and the author of the TRAC admin tool.  The main controller is based on your design. 
     7
     8#Long live open source! 
    29 
    310import re 
     
    2532    properties = Properties() #get set up with with a properties instance... 
    2633         
    27     def process_testmanager_request(self, req ): 
     34    def process_testmanager_request(self, req, data=None ): 
    2835        #check for errors in the testcases and configuration, if there are no errors let the user know, and vice versa 
    2936        try: 
     
    3138             
    3239            if errors :  
    33                 req.hdf['testcase.run.errormessage'] = errors 
    34                 return "testRunNotConfigured.cs", None 
     40                data["errorMessage"] = "error fetching test case list" 
     41                data["errorsList"] = errors 
     42                return "testRunNotConfigured.html", data, None 
    3543            else: 
    36                 req.hdf['testcase.validate.pathConfiguration'] = self.properties.getTestCasePath( self, req) 
    37                 req.hdf['testcase.validate.urlPath'] = req.base_url + "/testmanagement/runs?pathConfiguration=" + self.properties.getTestCasePath( self, req)  
    38                 return "validated.cs", None 
     44                data['validate_pathConfiguration'] = self.properties.getTestCasePath( self, req) 
     45                data['validate_urlPath'] = req.base_url + "/testmanagement/runs?pathConfiguration=" + self.properties.getTestCasePath( self, req)  
     46                return "validated.html", data, None 
    3947        except Exception, ex: 
    40             req.hdf['testcase.run.errormessage'] = str( ex ) 
    41             return "testRunNotConfigured.cs", None 
     48            data["errorMessage"] = "error fetching test case list" 
     49            data["errorsList"] = str( ex ) 
     50            return "testRunNotConfigured.html", data, None 
    4251             
    4352    def get_path( self, req ):