update subcommand curl docs

This commit is contained in:
buyuxiang
2022-07-22 18:18:21 +08:00
parent a70b11401e
commit 3c160aeec6
17 changed files with 104 additions and 20 deletions
+6 -4
View File
@@ -14,7 +14,7 @@ import (
var runCurlCmd = &cobra.Command{
Use: "curl URLs",
Short: "run API test with go engine using converted curl testcase",
Short: "run API test with go engine by curl command",
Args: cobra.MinimumNArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {
setLogLevel(logLevel)
@@ -29,7 +29,7 @@ var runCurlCmd = &cobra.Command{
var boomCurlCmd = &cobra.Command{
Use: "curl URLs",
Short: "run load test with boomer using converted curl testcase",
Short: "run load test with boomer by curl command",
Args: cobra.MinimumNArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {
boomer.SetUlimit(10240) // ulimit -n 10240
@@ -46,7 +46,7 @@ var boomCurlCmd = &cobra.Command{
var convertCurlCmd = &cobra.Command{
Use: "curl URLs",
Short: "convert curl command(s) to httprunner testcase",
Short: "convert curl command to httprunner testcase",
Args: cobra.MinimumNArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {
setLogLevel(logLevel)
@@ -97,10 +97,12 @@ func makeCurlTestCase(args []string) *hrp.TestCase {
}
casePath, err := os.Getwd()
if err != nil {
casePath = ""
log.Error().Err(err).Msg("get working directory failed")
}
testCase, err := tCase.ToTestCase(casePath)
if err != nil {
log.Error().Err(err).Msg("convert testcase failed")
log.Error().Err(err).Msg("convert testcase to failed")
os.Exit(1)
}
return testCase
+2 -2
View File
@@ -66,8 +66,8 @@ func TestLoadCurlCase(t *testing.T) {
// curl -F "dummyName=dummyFile" -F file1=@file1.txt -F file2=@file2.txt https://httpbin.org/post
if !assert.Equal(t, map[string]interface{}{
"dummyName": "dummyFile",
"file1": "@file1.txt",
"file2": "@file2.txt",
"file1": "file1.txt",
"file2": "file2.txt",
}, tCase.TestSteps[3].Request.Upload) {
t.Fatal()
}
@@ -1,4 +1,4 @@
# NOTE: Generated By hrp v4.1.5, DO NOT EDIT!
# NOTE: Generated By hrp v4.1.6, DO NOT EDIT!
import sys
import os
@@ -10,6 +10,7 @@ from debugtalk import *
if __name__ == "__main__":
import funppy
funppy.register("get_user_agent", get_user_agent)
funppy.register("sleep", sleep)
funppy.register("sum", sum)
@@ -1,4 +1,4 @@
// NOTE: Generated By hrp v4.1.5, DO NOT EDIT!
// NOTE: Generated By hrp v4.1.6, DO NOT EDIT!
package main
import (