mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
refactor: replace httpbin service with docker
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
config:
|
||||
name: basic test with httpbin
|
||||
base_url: https://httpbin.org/
|
||||
base_url: ${get_httpbin_server()}
|
||||
|
||||
teststeps:
|
||||
-
|
||||
@@ -10,7 +10,7 @@ teststeps:
|
||||
method: GET
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
- eq: [body.headers.Host, "httpbin.org"]
|
||||
- eq: [body.headers.Host, "127.0.0.1"]
|
||||
|
||||
-
|
||||
name: user-agent
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# NOTE: Generated By HttpRunner v4.1.4
|
||||
# NOTE: Generated By HttpRunner v4.3.5
|
||||
# FROM: basic.yml
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest
|
||||
|
||||
|
||||
class TestCaseBasic(HttpRunner):
|
||||
|
||||
config = Config("basic test with httpbin").base_url("https://httpbin.org/")
|
||||
config = Config("basic test with httpbin").base_url("${get_httpbin_server()}")
|
||||
|
||||
teststeps = [
|
||||
Step(
|
||||
@@ -13,7 +13,7 @@ class TestCaseBasic(HttpRunner):
|
||||
.get("/headers")
|
||||
.validate()
|
||||
.assert_equal("status_code", 200)
|
||||
.assert_equal("body.headers.Host", "httpbin.org")
|
||||
.assert_equal("body.headers.Host", "127.0.0.1")
|
||||
),
|
||||
Step(
|
||||
RunRequest("user-agent")
|
||||
|
||||
@@ -6,9 +6,11 @@ import uuid
|
||||
|
||||
from loguru import logger
|
||||
|
||||
from httprunner.utils_test import HTTP_BIN_URL
|
||||
|
||||
|
||||
def get_httpbin_server():
|
||||
return "https://httpbin.org"
|
||||
return HTTP_BIN_URL
|
||||
|
||||
|
||||
def setup_testcase(variables):
|
||||
@@ -17,7 +19,7 @@ def setup_testcase(variables):
|
||||
|
||||
|
||||
def teardown_testcase():
|
||||
logger.info(f"teardown_testcase.")
|
||||
logger.info("teardown_testcase.")
|
||||
|
||||
|
||||
def setup_teststep(request, variables):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# NOTE: Generated By HttpRunner v4.1.4
|
||||
# NOTE: Generated By HttpRunner v4.3.5
|
||||
# FROM: hooks.yml
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# NOTE: Generated By HttpRunner v4.1.4
|
||||
# NOTE: Generated By HttpRunner v4.3.5
|
||||
# FROM: load_image.yml
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# NOTE: Generated By HttpRunner v4.1.4
|
||||
# NOTE: Generated By HttpRunner v4.3.5
|
||||
# FROM: upload.yml
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
config:
|
||||
name: basic test with httpbin
|
||||
base_url: https://httpbin.org/
|
||||
base_url: ${get_httpbin_server()}
|
||||
|
||||
teststeps:
|
||||
-
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# NOTE: Generated By HttpRunner v4.1.4
|
||||
# NOTE: Generated By HttpRunner v4.3.5
|
||||
# FROM: validate.yml
|
||||
from httprunner import HttpRunner, Config, Step, RunRequest
|
||||
|
||||
|
||||
class TestCaseValidate(HttpRunner):
|
||||
|
||||
config = Config("basic test with httpbin").base_url("https://httpbin.org/")
|
||||
config = Config("basic test with httpbin").base_url("${get_httpbin_server()}")
|
||||
|
||||
teststeps = [
|
||||
Step(
|
||||
|
||||
Reference in New Issue
Block a user