MCPcopy
hub / github.com/httprunner/httprunner / assertRunTestCases

Function assertRunTestCases

hrp/runner_test.go:63–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func assertRunTestCases(t *testing.T) {
64 refCase := TestCasePath(demoTestCaseWithPluginJSONPath)
65 testcase1 := &TestCase{
66 Config: NewConfig("TestCase1").
67 SetBaseURL("https://postman-echo.com"),
68 TestSteps: []IStep{
69 NewStep("testcase1-step1").
70 GET("/headers").
71 Validate().
72 AssertEqual("status_code", 200, "check status code").
73 AssertEqual("headers.\"Content-Type\"", "application/json; charset=utf-8", "check http response Content-Type"),
74 NewStep("testcase1-step2").CallRefCase(
75 &TestCase{
76 Config: NewConfig("testcase1-step3-ref-case").SetBaseURL("https://postman-echo.com"),
77 TestSteps: []IStep{
78 NewStep("ip").
79 GET("/ip").
80 Validate().
81 AssertEqual("status_code", 200, "check status code").
82 AssertEqual("headers.\"Content-Type\"", "application/json; charset=utf-8", "check http response Content-Type"),
83 },
84 },
85 ),
86 NewStep("testcase1-step3").CallRefCase(&refCase),
87 },
88 }
89 testcase2 := &TestCase{
90 Config: NewConfig("TestCase2").SetWeight(3),
91 }
92
93 r := NewRunner(t)
94 r.SetPluginLogOn()
95 err := r.Run(testcase1, testcase2)
96 if err != nil {
97 t.Fatalf("run testcase error: %v", err)
98 }
99}
100
101func TestRunCaseWithThinkTime(t *testing.T) {
102 buildHashicorpGoPlugin()

Callers 2

TestRunCaseWithGoPluginFunction · 0.85

Calls 12

TestCasePathTypeAlias · 0.85
NewConfigFunction · 0.85
NewStepFunction · 0.85
NewRunnerFunction · 0.85
SetBaseURLMethod · 0.80
AssertEqualMethod · 0.80
GETMethod · 0.80
CallRefCaseMethod · 0.80
SetWeightMethod · 0.80
SetPluginLogOnMethod · 0.80
RunMethod · 0.65
ValidateMethod · 0.45

Tested by

no test coverage detected