mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
refactor: change param name
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
import pytest
|
||||
from httprunner import parse_parameters
|
||||
from httprunner import Parameters
|
||||
|
||||
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||
@@ -11,8 +11,8 @@ from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||
|
||||
class TestCaseRequestWithParameters(HttpRunner):
|
||||
@pytest.mark.parametrize(
|
||||
"parameters",
|
||||
parse_parameters(
|
||||
"param",
|
||||
Parameters(
|
||||
{
|
||||
"user_agent": ["iOS/10.1", "iOS/10.2"],
|
||||
"username-password": "${parameterize(request_methods/account.csv)}",
|
||||
@@ -20,8 +20,8 @@ class TestCaseRequestWithParameters(HttpRunner):
|
||||
}
|
||||
),
|
||||
)
|
||||
def test_start(self, parameters):
|
||||
super().test_start(parameters)
|
||||
def test_start(self, param):
|
||||
super().test_start(param)
|
||||
|
||||
config = (
|
||||
Config("request methods testcase: validate with parameters")
|
||||
|
||||
@@ -3,7 +3,7 @@ __description__ = "One-stop solution for HTTP(S) testing."
|
||||
|
||||
# import firstly for monkey patch if needed
|
||||
from httprunner.ext.locust import main_locusts
|
||||
from httprunner.parser import parse_parameters
|
||||
from httprunner.parser import parse_parameters as Parameters
|
||||
from httprunner.runner import HttpRunner
|
||||
from httprunner.testcase import Config, Step, RunRequest, RunTestCase
|
||||
|
||||
@@ -15,5 +15,5 @@ __all__ = [
|
||||
"Step",
|
||||
"RunRequest",
|
||||
"RunTestCase",
|
||||
"parse_parameters",
|
||||
"Parameters",
|
||||
]
|
||||
|
||||
@@ -46,7 +46,7 @@ sys.path.insert(0, str(Path(__file__){% for _ in range(diff_levels) %}.parent{%
|
||||
|
||||
{% if parameters %}
|
||||
import pytest
|
||||
from httprunner import parse_parameters
|
||||
from httprunner import Parameters
|
||||
{% endif %}
|
||||
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||
@@ -57,9 +57,9 @@ from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
|
||||
class {{ class_name }}(HttpRunner):
|
||||
|
||||
{% if parameters %}
|
||||
@pytest.mark.parametrize('parameters', parse_parameters({{parameters}}))
|
||||
def test_start(self, parameters):
|
||||
super().test_start(parameters)
|
||||
@pytest.mark.parametrize("param", Parameters({{parameters}}))
|
||||
def test_start(self, param):
|
||||
super().test_start(param)
|
||||
{% endif %}
|
||||
|
||||
config = {{ config_chain_style }}
|
||||
|
||||
@@ -421,7 +421,7 @@ class HttpRunner(object):
|
||||
step_datas=self.__step_datas,
|
||||
)
|
||||
|
||||
def test_start(self, parameters: Dict = None) -> "HttpRunner":
|
||||
def test_start(self, param: Dict = None) -> "HttpRunner":
|
||||
"""main entrance, discovered by pytest"""
|
||||
self.__init_tests__()
|
||||
self.__project_meta = self.__project_meta or load_project_meta(
|
||||
@@ -435,8 +435,8 @@ class HttpRunner(object):
|
||||
|
||||
# parse config name
|
||||
config_variables = self.__config.variables
|
||||
if parameters:
|
||||
config_variables.update(parameters)
|
||||
if param:
|
||||
config_variables.update(param)
|
||||
config_variables.update(self.__session_variables)
|
||||
self.__config.name = parse_data(
|
||||
self.__config.name, config_variables, self.__project_meta.functions
|
||||
|
||||
Reference in New Issue
Block a user