change: replace httpbin.org with docker service

This commit is contained in:
lilong.129
2023-07-22 00:18:21 +08:00
parent 52fc9c3a17
commit c712aa425e
7 changed files with 22 additions and 8 deletions

View File

@@ -10,7 +10,7 @@ func TestBoomerStandaloneRun(t *testing.T) {
defer removeHashicorpGoPlugin()
testcase1 := &TestCase{
Config: NewConfig("TestCase1").SetBaseURL("https://httpbin.org"),
Config: NewConfig("TestCase1").SetBaseURL(HTTP_BIN_URL),
TestSteps: []IStep{
NewStep("headers").
GET("/headers").

View File

@@ -1,4 +1,4 @@
// NOTE: Generated By hrp v4.3.4, DO NOT EDIT!
// NOTE: Generated By hrp v4.3.5, DO NOT EDIT!
package main
import (

View File

@@ -12,6 +12,8 @@ import (
"github.com/stretchr/testify/assert"
)
const HTTP_BIN_URL = "http://127.0.0.1:80"
func buildHashicorpGoPlugin() {
log.Info().Msg("[init] build hashicorp go plugin")
err := BuildPlugin(tmpl("plugin/debugtalk.go"), tmpl("debugtalk.bin"))
@@ -63,7 +65,7 @@ func assertRunTestCases(t *testing.T) {
refCase := TestCasePath(demoTestCaseWithPluginJSONPath)
testcase1 := &TestCase{
Config: NewConfig("TestCase1").
SetBaseURL("https://httpbin.org"),
SetBaseURL(HTTP_BIN_URL),
TestSteps: []IStep{
NewStep("testcase1-step1").
GET("/headers").
@@ -77,7 +79,7 @@ func assertRunTestCases(t *testing.T) {
AssertEqual("headers.\"Content-Type\"", "application/json", "check http response Content-Type"),
NewStep("testcase1-step3").CallRefCase(
&TestCase{
Config: NewConfig("testcase1-step3-ref-case").SetBaseURL("https://httpbin.org"),
Config: NewConfig("testcase1-step3-ref-case").SetBaseURL(HTTP_BIN_URL),
TestSteps: []IStep{
NewStep("ip").
GET("/ip").

View File

@@ -165,7 +165,7 @@ func TestRunCaseWithTimeout(t *testing.T) {
testcase1 := &TestCase{
Config: NewConfig("TestCase1").
SetRequestTimeout(10). // set global timeout to 10s
SetBaseURL("https://httpbin.org"),
SetBaseURL(HTTP_BIN_URL),
TestSteps: []IStep{
NewStep("step1").
GET("/delay/1").
@@ -181,7 +181,7 @@ func TestRunCaseWithTimeout(t *testing.T) {
testcase2 := &TestCase{
Config: NewConfig("TestCase2").
SetRequestTimeout(10). // set global timeout to 10s
SetBaseURL("https://httpbin.org"),
SetBaseURL(HTTP_BIN_URL),
TestSteps: []IStep{
NewStep("step1").
GET("/delay/11").
@@ -198,7 +198,7 @@ func TestRunCaseWithTimeout(t *testing.T) {
testcase3 := &TestCase{
Config: NewConfig("TestCase3").
SetRequestTimeout(10).
SetBaseURL("https://httpbin.org"),
SetBaseURL(HTTP_BIN_URL),
TestSteps: []IStep{
NewStep("step2").
GET("/delay/11").

View File

@@ -6,10 +6,12 @@ import (
"github.com/httprunner/httprunner/v4/hrp"
)
const HTTP_BIN_URL = "http://127.0.0.1:80"
func TestCaseUploadFile(t *testing.T) {
testcase := &hrp.TestCase{
Config: hrp.NewConfig("test upload file to httpbin").
SetBaseURL("https://httpbin.org").
SetBaseURL(HTTP_BIN_URL).
WithVariables(map[string]interface{}{"upload_file": "test.env"}),
TestSteps: []hrp.IStep{
hrp.NewStep("upload file explicitly").