10 print "Performing : initialize"
11 print "current options",self.options
12 print "e.g. verbose=",self.options.verbose
17 def testcase_1 (self):
18 print "\tRunning testcase 1"
20 def testcase_2 (self):
21 print "\tRunning testcase 2"
23 def testcase_3 (self):
24 print "\tRunning testcase 3"
26 def testcase_standard (self):
27 print "\tRunning testcase standard"
31 from optparse import OptionParser
32 usage="""Usage: %prog [options] steps
33 steps can include + like in %prog 1 2+3"""
34 parser = OptionParser (usage=usage)
35 parser.add_option ("-v","--verbose",action="store_true",
36 dest="verbose",default=False,
37 help="run in verbose mode")
38 parser.add_option ("-a","--all",action="store_true",
39 dest="all",default=False,
40 help="Run all known testcases")
41 (self.options, args)=parser.parse_args()
43 ### get the list of steps to run
46 # locates all local methods starting with "testcase_"
47 for method_name in dir(self):
48 # does it start with testcase_
49 if (method_name.find('testcase_',0,len('testcase_'))==0):
50 print 'considering method',method_name
54 # support for the 2+3 syntax
55 steplist=arg.split("+")
57 steps += [ 'testcase_'+step]
60 # args contains the steps to run
61 for method_name in steps:
62 method=getattr(self,method_name)
64 print '============================== TestCases mainloop'
69 if __name__ == "__main__":