refactor: rename API

This commit is contained in:
debugtalk
2021-10-10 12:21:24 +08:00
parent e1411c36da
commit ce06ee09db
11 changed files with 16 additions and 17 deletions

View File

@@ -20,7 +20,7 @@ HttpBoomer is a golang implementation of [HttpRunner]. Ideally, HttpBoomer will
- [x] Supports `variables`/`extract`/`validate`/`hooks` mechanisms to create extremely complex test scenarios. - [x] Supports `variables`/`extract`/`validate`/`hooks` mechanisms to create extremely complex test scenarios.
- [ ] Built-in integration of rich functions, and you can also use [`go plugin`][plugin] to create and call custom functions. - [ ] Built-in integration of rich functions, and you can also use [`go plugin`][plugin] to create and call custom functions.
- [x] Inherit all powerful features of [`Boomer`][Boomer] and [`locust`][locust], you can run `load test` without extra work. - [x] Inherit all powerful features of [`Boomer`][Boomer] and [`locust`][locust], you can run `load test` without extra work.
- [ ] Use it as a `CLI tool` or as a `library` are both supported. - [x] Use it as a `CLI tool` or as a `library` are both supported.
## Quick Start ## Quick Start
@@ -35,7 +35,6 @@ $ go get -u github.com/httprunner/httpboomer
This is an example of HttpBoomer testcase. You can find more in the [`examples`][examples] directory. This is an example of HttpBoomer testcase. You can find more in the [`examples`][examples] directory.
```go ```go
import ( import (
"testing" "testing"
@@ -86,7 +85,7 @@ func TestCaseDemo(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }

View File

@@ -6,7 +6,7 @@ import (
"github.com/myzhan/boomer" "github.com/myzhan/boomer"
) )
func Run(testcases ...ITestCase) { func Boom(testcases ...ITestCase) {
NewBoomer().Run(testcases...) NewBoomer().Run(testcases...)
} }

View File

@@ -122,7 +122,7 @@ func TestLoadJSONAndRun(t *testing.T) {
if !assert.NoError(t, err) { if !assert.NoError(t, err) {
t.Fail() t.Fail()
} }
err = Test(t, testcase) err = Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }

View File

@@ -50,7 +50,7 @@ func TestCaseDemo(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }

View File

@@ -37,7 +37,7 @@ func TestCaseExtractStepSingle(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }
@@ -82,7 +82,7 @@ func TestCaseExtractStepAssociation(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }

View File

@@ -40,7 +40,7 @@ func TestCaseCallFunction(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }

View File

@@ -57,7 +57,7 @@ func TestCaseBasicRequest(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }

View File

@@ -51,7 +51,7 @@ func TestCaseValidateStep(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }

View File

@@ -33,7 +33,7 @@ func TestCaseConfigVariables(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }
@@ -66,7 +66,7 @@ func TestCaseStepVariables(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }
@@ -104,7 +104,7 @@ func TestCaseOverrideConfigVariables(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }
@@ -151,7 +151,7 @@ func TestCaseParseVariables(t *testing.T) {
}, },
} }
err := httpboomer.Test(t, testcase) err := httpboomer.Run(t, testcase)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }

View File

@@ -8,7 +8,7 @@ import (
"github.com/imroc/req" "github.com/imroc/req"
) )
func Test(t *testing.T, testcases ...ITestCase) error { func Run(t *testing.T, testcases ...ITestCase) error {
return NewRunner().WithTestingT(t).SetDebug(true).Run(testcases...) return NewRunner().WithTestingT(t).SetDebug(true).Run(testcases...)
} }

View File

@@ -32,7 +32,7 @@ func TestHttpRunner(t *testing.T) {
} }
testcase3 := &TestCasePath{demoTestCaseJSONPath} testcase3 := &TestCasePath{demoTestCaseJSONPath}
err := Test(t, testcase1, testcase2, testcase3) err := Run(t, testcase1, testcase2, testcase3)
if err != nil { if err != nil {
t.Fatalf("run testcase error: %v", err) t.Fatalf("run testcase error: %v", err)
} }