mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 19:47:14 +08:00
Merge branch 'master' into leo_dev
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
|
"$id": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/api.schema.json",
|
||||||
|
"title": "Api for httprunner",
|
||||||
|
"description": "Api for httprunner",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Name of the api"
|
||||||
|
},
|
||||||
|
"base_url": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The base_url will be added before a relative URI"
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/request.schema.json"
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Variables for the api"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Extract rules",
|
||||||
|
"items": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/extract.schema.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"validate": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Validate rules",
|
||||||
|
"items": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/validate.schema.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"request"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
|
"$id": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/config.schema.json",
|
||||||
|
"title": "Config for httprunner",
|
||||||
|
"description": "Used in teststep/testcase/testsuite",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"base_url": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The base_url will be added before a relative URI"
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"setup_hooks": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/hook.schema.json"
|
||||||
|
},
|
||||||
|
"teardown_hooks": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/hook.schema.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
|
"$id": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/extract.schema.json",
|
||||||
|
"title": "Extract rules for httprunner",
|
||||||
|
"description": "Used to extract variables for later requests",
|
||||||
|
"type": "object",
|
||||||
|
"patternProperties": {
|
||||||
|
".*": {
|
||||||
|
"description": "extracted_variable_name: extract_rule",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
|
"$id": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/hook.schema.json",
|
||||||
|
"title": "setup_hooks or teardown_hooks for httprunner",
|
||||||
|
"description": "Define setup_hooks or teardown_hooks for httprunner",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
|
"$id": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/request.schema.json",
|
||||||
|
"title": "request for httprunner",
|
||||||
|
"description": "Used to define a api or used in a teststep. Same parameters as python's package 'requests'",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"method": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Request method",
|
||||||
|
"enum": [
|
||||||
|
"GET",
|
||||||
|
"POST",
|
||||||
|
"OPTIONS",
|
||||||
|
"HEAD",
|
||||||
|
"PUT",
|
||||||
|
"PATCH",
|
||||||
|
"DELETE"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"description": "Request url",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Used to define the parameters of a 'GET' request"
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Used to define the parameters of a 'POST' request in the application/x-www-form-urlencoded format"
|
||||||
|
},
|
||||||
|
"json": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Used to define the parameters of a 'POST' request in the application/json format"
|
||||||
|
},
|
||||||
|
"headers": {
|
||||||
|
"description": "Request headers",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"cookies": {
|
||||||
|
"description": "Request cookies",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"files": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"type": "array"
|
||||||
|
},
|
||||||
|
"timeout": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"allow_redirects": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"proxies": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"verify": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"stream": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"cert": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "array",
|
||||||
|
"maxItems": 2,
|
||||||
|
"minItems": 2,
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"method",
|
||||||
|
"url"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
|
"$id": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/validate.schema.json",
|
||||||
|
"title": "Validate rule of httprunner",
|
||||||
|
"description": "Validate rule of httprunner",
|
||||||
|
"type": "object",
|
||||||
|
"patternProperties": {
|
||||||
|
".*": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "validate_function_name: [check_value, expect_value]",
|
||||||
|
"minItems": 2,
|
||||||
|
"maxItems": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
|
"$id": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/testcase.schema.json",
|
||||||
|
"title": "Testcase for httprunner",
|
||||||
|
"description": "Testcase for httprunner",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"config": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/config.schema.json"
|
||||||
|
},
|
||||||
|
"teststeps": {
|
||||||
|
"description": "Teststep of a testcase",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/teststep"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"teststeps"
|
||||||
|
],
|
||||||
|
"definitions": {
|
||||||
|
"teststep": {
|
||||||
|
"type": "object",
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"description": "Teststep name",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"api": {
|
||||||
|
"description": "Api reference, it's usually the relative path of the api",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"description": "Extract rules",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/extract.schema.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"validate": {
|
||||||
|
"description": "Validate rules",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/validate.schema.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"setup_hooks": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/hook.schema.json"
|
||||||
|
},
|
||||||
|
"teardown_hooks": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/hook.schema.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"api"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"description": "Teststep name",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/request.schema.json"
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"extract": {
|
||||||
|
"description": "Extract rules",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/extract.schema.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"validate": {
|
||||||
|
"description": "Validate rules",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/validate.schema.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"setup_hooks": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/hook.schema.json"
|
||||||
|
},
|
||||||
|
"teardown_hooks": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/hook.schema.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"request"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema",
|
||||||
|
"$id": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/testsuite.schema.json",
|
||||||
|
"title": "Testsuite for httprunner",
|
||||||
|
"description": "Testsuite for httprunner",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"config": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/config.schema.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"verify": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"testcases": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/testcase"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"setup_hooks": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/hook.schema.json"
|
||||||
|
},
|
||||||
|
"teardown_hooks": {
|
||||||
|
"$ref": "https://raw.githubusercontent.com/readyou/httprunner/dev/httprunner/loader/schemas/v2/common/hook.schema.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"testcases"
|
||||||
|
],
|
||||||
|
"definitions": {
|
||||||
|
"testcase": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"description": "Testcase name",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"parameters": {
|
||||||
|
"description": "Parameters will generate cartesian product variables, each set of variables is tested once",
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"testcase": {
|
||||||
|
"description": "Testcase reference, it's usually the relative path of the testcase",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"testcase"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,7 +41,7 @@ def gen_html_report(summary, report_template=None, report_dir=None, report_file=
|
|||||||
report_file_name = os.path.basename(report_file)
|
report_file_name = os.path.basename(report_file)
|
||||||
else:
|
else:
|
||||||
report_dir = report_dir or os.path.join(os.getcwd(), "reports")
|
report_dir = report_dir or os.path.join(os.getcwd(), "reports")
|
||||||
report_file_name = "{}.html".format(start_at_timestamp)
|
report_file_name = "{}.html".format(int(start_at_timestamp * 1000))
|
||||||
|
|
||||||
if not os.path.isdir(report_dir):
|
if not os.path.isdir(report_dir):
|
||||||
os.makedirs(report_dir)
|
os.makedirs(report_dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user