mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 22:44:05 +08:00
feat: load test cases from TestCaseJSON
This commit is contained in:
@@ -48,6 +48,23 @@ func TestLoadTestCases(t *testing.T) {
|
||||
if !assert.Equal(t, len(testCases), 1) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
// load test cases from TestCaseJSON
|
||||
testcaseJSON := TestCaseJSON(`
|
||||
{
|
||||
"config":{"name":"TestCaseJSON"},
|
||||
"teststeps":[
|
||||
{"name": "step1", "request":{"url": "https://httpbin.org/get"}},
|
||||
{"name": "step2", "shell":{"string": "ls -l"}}
|
||||
]
|
||||
}`)
|
||||
testCases, err = LoadTestCases(&testcaseJSON)
|
||||
if !assert.Nil(t, err) {
|
||||
t.Fatal()
|
||||
}
|
||||
if !assert.Equal(t, len(testCases), 1) {
|
||||
t.Fatal()
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadCase(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user