test_allAPI.py 967 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import json
  2. from pathlib import Path
  3. import allure
  4. import pytest
  5. from common.parameterize import ddt, read_testcase
  6. from common.request_util import RequestUtil
  7. # path = Path(__file__).parent.glob("**/*.yaml")
  8. def creat_case(yaml_path):
  9. @pytest.mark.parametrize("arg_names", read_testcase(rf"{yaml_path}"))
  10. def test_fun(self, arg_names):
  11. allure.dynamic.title(arg_names["name"])
  12. RequestUtil("base_qccq_sc").standard_yaml(arg_names)
  13. return test_fun
  14. @allure.epic("青春重庆")
  15. @allure.feature("用户管理模块")
  16. class TestAPI:
  17. pass
  18. # for yaml_path in path:
  19. # yaml_name = yaml_path.name[:-5]
  20. # setattr(TestAPI, yaml_name, creat_case(yaml_path))
  21. data = [Path(r"test_case/qccq/个人中心/test_001_个人中心-我的消息.yaml")]
  22. # for yaml_path in path:
  23. # data.append(yaml_path)
  24. # data.sort()
  25. for yaml_path in data:
  26. yaml_name = yaml_path.name[:-5]
  27. setattr(TestAPI, yaml_name, creat_case(yaml_path))