refactor parameterization:

parameter value now can be in three types:
(1) data list
(2) call built-in parameterize function
(3) call custom function in debugtalk.py
This commit is contained in:
debugtalk
2018-03-07 00:15:06 +08:00
parent 85c49e6924
commit f53baaf757
8 changed files with 124 additions and 51 deletions

View File

@@ -48,3 +48,15 @@ def skip_test_in_production_env():
""" skip this test in production environment
"""
return os.environ["TEST_ENV"] == "PRODUCTION"
def gen_app_version():
return [
{"app_version": "2.8.5"},
{"app_version": "2.8.6"}
]
def get_account():
return [
{"username": "user1", "password": "111111"},
{"username": "user2", "password": "222222"}
]

View File

@@ -1,13 +1,13 @@
- config:
name: "user management testset."
parameters:
- user_agent: Random
- app_version: Sequential
- user_agent: ["iOS/10.1", "iOS/10.2", "iOS/10.3"]
- app_version: ${gen_app_version()}
- username: ${parameterize(account.csv)}
variables:
- user_agent: 'iOS/10.3'
- device_sn: ${gen_random_string(15)}
- os_platform: 'ios'
- app_version: '2.8.6'
request:
base_url: $BASE_URL
headers:
@@ -17,7 +17,7 @@
- token
- test:
name: get token with $user_agent and $app_version
name: get token with $user_agent and $app_version, username $username
api: get_token($user_agent, $device_sn, $os_platform, $app_version)
extract:
- token: content.token