1 class Case:
2 """
3 测试用例类
4 """
5 def Case1(self):
6 print("Case1")
7
8 def Case2(self):
9 print("Case2")
10
11 def Case3(self):
12 print("Case3")
13
14
15 class RunCase:
16 """
17 运行测试用例类
18 说明:运行每一条脚本都需要重新启动客户端,运行完单条仍需要关闭客户端
19 """
20 def start(self):
21 print("start方法")
22
23 def quit(self):
24 print("关闭方法")
25
26 for i in range(1,3):
27 b = exec("""def runcase%s(self):
28 self.start()
29 Case().Case%s()
30 self.quit()
31 """%(i, i))
32
33 def Run():
34 """
35 主入口函数
36 :return:
37 """
38 Run = RunCase()
39 for i in range(1,3):
40 a = eval("Run.runcase%s()" % i)
41 print("a:", a)
42
43 if __name__ == '__main__':
44 Run()