Changes between Version 8 and Version 9 of TestManagerForTracPluginRPCApi


Ignore:
Timestamp:
Jan 20, 2011 8:27:01 PM (3 years ago)
Author:
seccanj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TestManagerForTracPluginRPCApi

    v8 v9  
    103103{{{ 
    104104import xmlrpclib  
    105                   
     105 
     106# Remember to change the following URL with your information!!! 
     107 
    106108server = xmlrpclib.ServerProxy("http://user@yourserver:port/yourproject/rpc") 
     109 
    107110 
    108111print ">> Creating test catalog" 
     
    174177 
    175178# Recursive function to print a whole sub-catalog and its contained test cases 
    176 def printSubCatalog(cat_id): 
     179def printSubCatalog(cat_id, indent): 
     180    tcat = server.testmanager.getTestCatalog(cat_id) 
     181 
     182    indent_blanks = '' 
     183    for i in range(indent): 
     184        indent_blanks += '    ' 
     185 
     186    print indent_blanks + tcat[1] 
     187 
    177188    for subc in server.testmanager.listSubCatalogs(cat_id): 
    178189        subc_id = subc[0] 
    179         print subc[2] 
    180         printSubCatalog(subc_id) 
     190        printSubCatalog(subc_id, indent + 1) 
    181191 
    182192    for tc in server.testmanager.listTestCases(cat_id): 
    183         print tc[2] 
     193        tc_title = tc[2] 
     194        print indent_blanks + '    ' + tc_title 
    184195 
    185196# Recursive function to print a whole sub-catalog and its contained test cases with status 
    186197def printSubPlan(cat_id, plan_id, indent): 
    187198    tcat = server.testmanager.getTestCatalog(cat_id) 
    188     print str([' ' for i in range(indent)]) + tcat[1] 
     199 
     200    indent_blanks = '' 
     201    for i in range(indent): 
     202        indent_blanks += '    ' 
     203 
     204    print indent_blanks + tcat[1] 
    189205 
    190206    for subc in server.testmanager.listSubCatalogs(cat_id): 
     
    197213        tc = server.testmanager.getTestCase(tc_id) 
    198214        tc_title = tc[1] 
    199         print str([' ' for i in range(indent)]) + tc_title + ": "+tc_status 
     215        print indent_blanks + '    ' + tc_title + ": "+tc_status 
    200216 
    201217# Entry point to print a whole test plan and its contained test cases with status 
     
    211227 
    212228print ">> Printing complete test catalog tree" 
    213 printSubCatalog(root_cat) 
     229printSubCatalog(root_cat, 0) 
    214230 
    215231print ">> Printing complete test plan tree" 
     
    230246    print v 
    231247 
     248print ">> Printing again complete test plan tree, showing modified test case status" 
     249printPlan(root_cat, tplan) 
     250 
    232251}}}