test_allAPI.py 688 B

12345678910111213141516171819202122232425262728293031
  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))