run.py
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2022/12/8 21:52
# @Author : Shitou
# @FileName: run.py
# @Software: PyCharm
import unittest
from tools.function import runner_test
from common.handle_path import TestCase_Path, Report_Path
from testcase.test_01_login import TestLogin
from testcase.test_02_system_management import Test01Department, Test02Specialty, Test03Year
from testcase.test_03_teaching_affairs import Test01Teacher, Test02Class, Test03Course, Test04Student
from testcase.test_04_Internship_preparation import Test01addInternshipPlan, Test02publishInternshipPlan, \
Test03addInternshipProject, Test04publishInternshipProject
from testcase.test_05_student_practice import Test01SelectAllPractice, Test02StudentApply
from testcase.test_06_internship_manage import Test01SelectApplyAuditList, Test02Audit
"""
执行所有用例
"""
# 创建测试套件
suite_all = unittest.TestSuite()
# 加载用例
# ---创建加载器
load = unittest.TestLoader()
# ---用例放到加载器
suite_all.addTest(load.discover(TestCase_Path))
"""
执行单独模块用例
"""
a = unittest.TestLoader().loadTestsFromTestCase(Test02Audit)
suite = unittest.TestSuite([a])
runner_test(suite) # 执行
# input_case = input("请输入需要执行的用例:")
# try:
# if input_case in "全部":
# suite = suite_all
# elif input_case in "教师":
# suite = suite_teacher
# runner_test(suite) # 执行
#
# except NameError as a:
# print("输入错误")
# else:
# print("执行完毕,请确认")