Skip to content

Commit

Permalink
更新测试用例自动生成器和演示用例
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-clan committed Mar 28, 2023
1 parent 26e8a00 commit 7ce50cc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
7 changes: 5 additions & 2 deletions fastpt/test_case/test_project/test_api_test_case_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
from fastpt.utils.request.case_data_file_parse import get_request_data
from fastpt.utils.request.ids_extract import get_ids

request_data = get_request_data(read_yaml(filename=os.sep.join([PROJECT_NAME, 'api_test_case_template.yaml'])))
allure_text = request_data[0]['config']['allure']
request_data = get_request_data(
file_data=read_yaml(filename=os.sep.join([PROJECT_NAME, 'api_test_case_template.yaml'])),
use_pydantic_verify=True
)
allure_text = request_data[0]['config']['allure'] # noqa
request_ids = get_ids(request_data)


Expand Down
7 changes: 5 additions & 2 deletions fastpt/test_case/test_project/test_only_skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
from fastpt.utils.request.case_data_file_parse import get_request_data
from fastpt.utils.request.ids_extract import get_ids

request_data = get_request_data(read_yaml(filename=os.sep.join([PROJECT_NAME, 'only_skip.yml'])))
allure_text = request_data[0]['config']['allure']
request_data = get_request_data(
file_data=read_yaml(filename=os.sep.join([PROJECT_NAME, 'only_skip.yml'])),
use_pydantic_verify=False
)
allure_text = request_data[0]['config']['allure'] # noqa
request_ids = get_ids(request_data)


Expand Down
7 changes: 5 additions & 2 deletions fastpt/test_case/test_project/test_upload_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
from fastpt.utils.request.case_data_file_parse import get_request_data
from fastpt.utils.request.ids_extract import get_ids

request_data = get_request_data(read_yaml(filename=os.sep.join([PROJECT_NAME, 'upload_file.yaml'])))
allure_text = request_data[0]['config']['allure']
request_data = get_request_data(
file_data=read_yaml(filename=os.sep.join([PROJECT_NAME, 'upload_file.yaml'])),
use_pydantic_verify=True
)
allure_text = request_data[0]['config']['allure'] # noqa
request_ids = get_ids(request_data)


Expand Down
7 changes: 5 additions & 2 deletions fastpt/utils/case_auto_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ def auto_generate_test_cases(rewrite: bool = False) -> NoReturn:
from fastpt.utils.request.case_data_file_parse import get_request_data
from fastpt.utils.request.ids_extract import get_ids
request_data = get_request_data(read_yaml(filename=os.sep.join([PROJECT_NAME, '{yaml_filename}'])))
allure_text = request_data[0]['config']['allure']
request_data = get_request_data(
file_data=read_yaml(filename=os.sep.join([PROJECT_NAME, '{yaml_filename}'])),
use_pydantic_verify=False
)
allure_text = request_data[0]['config']['allure'] # noqa
request_ids = get_ids(request_data)
Expand Down

0 comments on commit 7ce50cc

Please sign in to comment.