(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestRendezvous(t *testing.T) { |
| 10 | testcase := &hrp.TestCase{ |
| 11 | Config: hrp.NewConfig("run request with rendezvous"). |
| 12 | SetBaseURL("https://postman-echo.com"). |
| 13 | WithVariables(map[string]interface{}{ |
| 14 | "n": 5, |
| 15 | "a": 12.3, |
| 16 | "b": 3.45, |
| 17 | }), |
| 18 | TestSteps: []hrp.IStep{ |
| 19 | hrp.NewStep("waiting for all users in the beginning"). |
| 20 | SetRendezvous("rendezvous0"), |
| 21 | hrp.NewStep("rendezvous before get"). |
| 22 | SetRendezvous("rendezvous1"). |
| 23 | WithUserNumber(50). |
| 24 | WithTimeout(3000), |
| 25 | hrp.NewStep("get with params"). |
| 26 | GET("/get"). |
| 27 | WithParams(map[string]interface{}{"foo1": "foo1", "foo2": "foo2"}). |
| 28 | WithHeaders(map[string]string{"User-Agent": "HttpRunnerPlus"}). |
| 29 | Extract(). |
| 30 | WithJmesPath("body.args.foo1", "varFoo1"). |
| 31 | Validate(). |
| 32 | AssertEqual("status_code", 200, "check status code"), |
| 33 | hrp.NewStep("rendezvous before post"). |
| 34 | SetRendezvous("rendezvous2"). |
| 35 | WithUserNumber(20). |
| 36 | WithTimeout(2000), |
| 37 | hrp.NewStep("post json data with functions"). |
| 38 | POST("/post"). |
| 39 | WithHeaders(map[string]string{"User-Agent": "HttpRunnerPlus"}). |
| 40 | WithBody(map[string]interface{}{"foo1": "foo1", "foo2": "foo2"}). |
| 41 | Validate(). |
| 42 | AssertEqual("status_code", 200, "check status code"). |
| 43 | AssertLengthEqual("body.json.foo1", 4, "check args foo1"). |
| 44 | AssertEqual("body.json.foo2", "foo2", "check args foo2"), |
| 45 | hrp.NewStep("waiting for all users in the end"). |
| 46 | SetRendezvous("rendezvous3"), |
| 47 | }, |
| 48 | } |
| 49 | err := hrp.NewRunner(t).Run(testcase) |
| 50 | if err != nil { |
| 51 | t.Fatalf("run testcase error: %v", err) |
| 52 | } |
| 53 | } |
nothing calls this directly
no test coverage detected