fix: unittest

This commit is contained in:
debugtalk
2022-03-18 21:48:42 +08:00
parent c252549568
commit df74aafd7b
4 changed files with 75 additions and 10 deletions

View File

@@ -24,10 +24,18 @@ func removeHashicorpPlugin() {
os.Remove("examples/debugtalk.bin")
}
func TestHttpRunner(t *testing.T) {
func TestHttpRunnerWithGoPlugin(t *testing.T) {
buildHashicorpPlugin()
defer removeHashicorpPlugin()
assertRunTestCases(t)
}
func TestHttpRunnerWithPythonPlugin(t *testing.T) {
assertRunTestCases(t)
}
func assertRunTestCases(t *testing.T) {
testcase1 := &TestCase{
Config: NewConfig("TestCase1").
SetBaseURL("http://httpbin.org"),
@@ -66,8 +74,6 @@ func TestHttpRunner(t *testing.T) {
testcase4 := &demoRefTestCaseJSONPath
r := NewRunner(t)
r.saveTests = true
r.genHTMLReport = true
err := r.Run(testcase1, testcase2, testcase3, testcase4)
if err != nil {
t.Fatalf("run testcase error: %v", err)