test_allAPI.py 935 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. from common.yaml_util import write_yaml_out_time_url
  8. path = Path(__file__).parent.glob("**/*.yaml")
  9. def creat_case(yaml_path):
  10. @pytest.mark.parametrize("arg_names", read_testcase(rf"{yaml_path}"))
  11. def test_fun(self, arg_names):
  12. allure.dynamic.title(arg_names["name"])
  13. RequestUtil("base_qccq_sc").standard_yaml(arg_names)
  14. return test_fun
  15. @allure.epic("青春重庆")
  16. @allure.feature("用户管理模块")
  17. class TestAPI:
  18. pass
  19. # for yaml_path in path:
  20. # yaml_name = yaml_path.name[:-5]
  21. # setattr(TestAPI, yaml_name, creat_case(yaml_path))
  22. data = []
  23. for yaml_path in path:
  24. data.append(yaml_path)
  25. data.sort()
  26. for yaml_path in data:
  27. yaml_name = yaml_path.name[:-5]
  28. setattr(TestAPI, yaml_name, creat_case(yaml_path))