mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-06 23:11:21 +08:00
fix #1288: unable to go get httprunner v4
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
**go version**
|
**go version**
|
||||||
|
|
||||||
- fix: step request elapsed timing should contain ContentTransfer part
|
- fix: step request elapsed timing should contain ContentTransfer part
|
||||||
|
- fix #1288: unable to go get httprunner v4
|
||||||
|
|
||||||
**python version**
|
**python version**
|
||||||
|
|
||||||
|
|||||||
@@ -36,4 +36,4 @@ Copyright 2017 debugtalk
|
|||||||
* [hrp run](hrp_run.md) - run API test with go engine
|
* [hrp run](hrp_run.md) - run API test with go engine
|
||||||
* [hrp startproject](hrp_startproject.md) - create a scaffold project
|
* [hrp startproject](hrp_startproject.md) - create a scaffold project
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 5-May-2022
|
###### Auto generated by spf13/cobra on 9-May-2022
|
||||||
|
|||||||
@@ -41,4 +41,4 @@ hrp boom [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 5-May-2022
|
###### Auto generated by spf13/cobra on 9-May-2022
|
||||||
|
|||||||
@@ -18,4 +18,4 @@ hrp convert $path... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 5-May-2022
|
###### Auto generated by spf13/cobra on 9-May-2022
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ hrp har2case $har_path... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 5-May-2022
|
###### Auto generated by spf13/cobra on 9-May-2022
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ hrp pytest $path ... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 5-May-2022
|
###### Auto generated by spf13/cobra on 9-May-2022
|
||||||
|
|||||||
@@ -35,4 +35,4 @@ hrp run $path... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 5-May-2022
|
###### Auto generated by spf13/cobra on 9-May-2022
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ hrp startproject $project_name [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 5-May-2022
|
###### Auto generated by spf13/cobra on 9-May-2022
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github.com/httprunner/httprunner
|
module github.com/httprunner/httprunner/v4
|
||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/httprunner/funplugin"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/funplugin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/boomer"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/boomer"
|
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/sdk"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewBoomer(spawnCount int, spawnRate float64) *HRPBoomer {
|
func NewBoomer(spawnCount int, spawnRate float64) *HRPBoomer {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/boomer"
|
"github.com/httprunner/httprunner/v4/hrp/internal/boomer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// boomCmd represents the boom command
|
// boomCmd represents the boom command
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/getsentry/sentry-go"
|
"github.com/getsentry/sentry-go"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/cmd"
|
"github.com/httprunner/httprunner/v4/hrp/cmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/convert"
|
"github.com/httprunner/httprunner/v4/hrp/internal/convert"
|
||||||
)
|
)
|
||||||
|
|
||||||
var convertCmd = &cobra.Command{
|
var convertCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/har2case"
|
"github.com/httprunner/httprunner/v4/hrp/internal/har2case"
|
||||||
)
|
)
|
||||||
|
|
||||||
// har2caseCmd represents the har2case command
|
// har2caseCmd represents the har2case command
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/pytest"
|
"github.com/httprunner/httprunner/v4/hrp/internal/pytest"
|
||||||
)
|
)
|
||||||
|
|
||||||
var pytestCmd = &cobra.Command{
|
var pytestCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/version"
|
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// rootCmd represents the base command when called without any subcommands
|
// rootCmd represents the base command when called without any subcommands
|
||||||
@@ -33,7 +33,7 @@ Website: https://httprunner.com
|
|||||||
Github: https://github.com/httprunner/httprunner
|
Github: https://github.com/httprunner/httprunner
|
||||||
Copyright 2017 debugtalk`,
|
Copyright 2017 debugtalk`,
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||||
var noColor = false
|
noColor := false
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
noColor = true
|
noColor = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// runCmd represents the run command
|
// runCmd represents the run command
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/scaffold"
|
"github.com/httprunner/httprunner/v4/hrp/internal/scaffold"
|
||||||
)
|
)
|
||||||
|
|
||||||
var scaffoldCmd = &cobra.Command{
|
var scaffoldCmd = &cobra.Command{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package hrp
|
|||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewConfig returns a new constructed testcase config with specified testcase name.
|
// NewConfig returns a new constructed testcase config with specified testcase name.
|
||||||
@@ -161,6 +161,4 @@ const (
|
|||||||
thinkTimeDefaultMultiply = 1
|
thinkTimeDefaultMultiply = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var thinkTimeDefaultRandom = map[string]float64{"min_percentage": 0.5, "max_percentage": 1.5}
|
||||||
thinkTimeDefaultRandom = map[string]float64{"min_percentage": 0.5, "max_percentage": 1.5}
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/prometheus/client_golang/prometheus/push"
|
"github.com/prometheus/client_golang/prometheus/push"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/json"
|
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Output is primarily responsible for printing test results to different destinations
|
// Output is primarily responsible for printing test results to different destinations
|
||||||
@@ -37,8 +37,7 @@ type Output interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ConsoleOutput is the default output for standalone mode.
|
// ConsoleOutput is the default output for standalone mode.
|
||||||
type ConsoleOutput struct {
|
type ConsoleOutput struct{}
|
||||||
}
|
|
||||||
|
|
||||||
// NewConsoleOutput returns a ConsoleOutput.
|
// NewConsoleOutput returns a ConsoleOutput.
|
||||||
func NewConsoleOutput() *ConsoleOutput {
|
func NewConsoleOutput() *ConsoleOutput {
|
||||||
@@ -102,12 +101,10 @@ func getTotalFailRatio(totalRequests, totalFailures int64) (failRatio float64) {
|
|||||||
|
|
||||||
// OnStart of ConsoleOutput has nothing to do.
|
// OnStart of ConsoleOutput has nothing to do.
|
||||||
func (o *ConsoleOutput) OnStart() {
|
func (o *ConsoleOutput) OnStart() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnStop of ConsoleOutput has nothing to do.
|
// OnStop of ConsoleOutput has nothing to do.
|
||||||
func (o *ConsoleOutput) OnStop() {
|
func (o *ConsoleOutput) OnStop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnEvent will print to the console.
|
// OnEvent will print to the console.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package boomer
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/json"
|
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
type transaction struct {
|
type transaction struct {
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/httprunner/funplugin/shared"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
"github.com/httprunner/funplugin/shared"
|
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Dump2JSON(data interface{}, path string) error {
|
func Dump2JSON(data interface{}, path string) error {
|
||||||
@@ -29,7 +29,7 @@ func Dump2JSON(data interface{}, path string) error {
|
|||||||
}
|
}
|
||||||
log.Info().Str("path", path).Msg("dump data to json")
|
log.Info().Str("path", path).Msg("dump data to json")
|
||||||
file, _ := json.MarshalIndent(data, "", " ")
|
file, _ := json.MarshalIndent(data, "", " ")
|
||||||
err = os.WriteFile(path, file, 0644)
|
err = os.WriteFile(path, file, 0o644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("dump json path failed")
|
log.Error().Err(err).Msg("dump json path failed")
|
||||||
return err
|
return err
|
||||||
@@ -56,7 +56,7 @@ func Dump2YAML(data interface{}, path string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.WriteFile(path, buffer.Bytes(), 0644)
|
err = os.WriteFile(path, buffer.Bytes(), 0o644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("dump yaml path failed")
|
log.Error().Err(err).Msg("dump yaml path failed")
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import (
|
|||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/sdk"
|
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/version"
|
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Convert2TestScripts(destType string, paths ...string) error {
|
func Convert2TestScripts(destType string, paths ...string) error {
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/json"
|
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/sdk"
|
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -348,7 +348,8 @@ func TestMakeValidate(t *testing.T) {
|
|||||||
Check: "status_code",
|
Check: "status_code",
|
||||||
Expect: 200,
|
Expect: 200,
|
||||||
Assert: "equals",
|
Assert: "equals",
|
||||||
Message: "assert response status code"}) {
|
Message: "assert response status code",
|
||||||
|
}) {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +362,8 @@ func TestMakeValidate(t *testing.T) {
|
|||||||
Check: "headers.\"Content-Type\"",
|
Check: "headers.\"Content-Type\"",
|
||||||
Expect: "application/json; charset=utf-8",
|
Expect: "application/json; charset=utf-8",
|
||||||
Assert: "equals",
|
Assert: "equals",
|
||||||
Message: "assert response header Content-Type"}) {
|
Message: "assert response header Content-Type",
|
||||||
|
}) {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +376,8 @@ func TestMakeValidate(t *testing.T) {
|
|||||||
Check: "body.Code",
|
Check: "body.Code",
|
||||||
Expect: float64(200), // TODO
|
Expect: float64(200), // TODO
|
||||||
Assert: "equals",
|
Assert: "equals",
|
||||||
Message: "assert response body Code"}) {
|
Message: "assert response body Code",
|
||||||
|
}) {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package pytest
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/sdk"
|
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/version"
|
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RunPytest(args []string) error {
|
func RunPytest(args []string) error {
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/httprunner/funplugin/shared"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/funplugin/shared"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/sdk"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type PluginType string
|
type PluginType string
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/version"
|
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IEvent interface {
|
type IEvent interface {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/version"
|
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/httprunner/funplugin"
|
||||||
|
"github.com/httprunner/funplugin/shared"
|
||||||
"github.com/maja42/goval"
|
"github.com/maja42/goval"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/funplugin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
"github.com/httprunner/funplugin/shared"
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func newParser() *Parser {
|
func newParser() *Parser {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/httprunner/funplugin"
|
"github.com/httprunner/funplugin"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/sdk"
|
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/json"
|
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
var fieldTags = []string{"proto", "status_code", "headers", "cookies", "body", textExtractorSubRegexp}
|
var fieldTags = []string{"proto", "status_code", "headers", "cookies", "body", textExtractorSubRegexp}
|
||||||
@@ -268,7 +268,7 @@ func (v *responseObject) searchRegexp(expr string) interface{} {
|
|||||||
}
|
}
|
||||||
match := regexpCompile.FindStringSubmatch(bodyStr)
|
match := regexpCompile.FindStringSubmatch(bodyStr)
|
||||||
if len(match) > 1 {
|
if len(match) > 1 {
|
||||||
return match[1] //return first matched result in parentheses
|
return match[1] // return first matched result in parentheses
|
||||||
}
|
}
|
||||||
log.Error().Str("expr", expr).Msg("search regexp failed")
|
log.Error().Str("expr", expr).Msg("search regexp failed")
|
||||||
return expr
|
return expr
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"golang.org/x/net/http2"
|
"golang.org/x/net/http2"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/sdk"
|
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Run starts to run API test with default configs.
|
// Run starts to run API test with default configs.
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/scaffold"
|
"github.com/httprunner/httprunner/v4/hrp/internal/scaffold"
|
||||||
)
|
)
|
||||||
|
|
||||||
func buildHashicorpGoPlugin() {
|
func buildHashicorpGoPlugin() {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package hrp
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IAPI represents interface for api,
|
// IAPI represents interface for api,
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/httpstat"
|
"github.com/httprunner/httprunner/v4/hrp/internal/httpstat"
|
||||||
"github.com/httprunner/httprunner/hrp/internal/json"
|
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HTTPMethod string
|
type HTTPMethod string
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package hrp
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ThinkTime struct {
|
type ThinkTime struct {
|
||||||
|
|||||||
@@ -3,15 +3,17 @@ package hrp
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gorilla/websocket"
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/json"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/rs/zerolog/log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
|
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/version"
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
|
"github.com/httprunner/httprunner/v4/hrp/internal/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newOutSummary() *Summary {
|
func newOutSummary() *Summary {
|
||||||
@@ -72,7 +73,7 @@ func (s *Summary) genHTMLReport() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reportPath := filepath.Join(reportsDir, fmt.Sprintf("report-%v.html", s.Time.StartAt.Unix()))
|
reportPath := filepath.Join(reportsDir, fmt.Sprintf("report-%v.html", s.Time.StartAt.Unix()))
|
||||||
file, err := os.OpenFile(reportPath, os.O_WRONLY|os.O_CREATE, 0666)
|
file, err := os.OpenFile(reportPath, os.O_WRONLY|os.O_CREATE, 0o666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("open file failed")
|
log.Error().Err(err).Msg("open file failed")
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ITestCase represents interface for testcases,
|
// ITestCase represents interface for testcases,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp/internal/builtin"
|
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -22,9 +22,7 @@ var (
|
|||||||
demoAPIGETPath APIPath = templatesDir + "/api/get.yml"
|
demoAPIGETPath APIPath = templatesDir + "/api/get.yml"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var demoTestCaseWithThinkTimePath TestCasePath = hrpExamplesDir + "/think_time_test.json"
|
||||||
demoTestCaseWithThinkTimePath TestCasePath = hrpExamplesDir + "/think_time_test.json"
|
|
||||||
)
|
|
||||||
|
|
||||||
var demoTestCaseWithPlugin = &TestCase{
|
var demoTestCaseWithPlugin = &TestCase{
|
||||||
Config: NewConfig("demo with complex mechanisms").
|
Config: NewConfig("demo with complex mechanisms").
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package tests
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// reference extracted variables for validation in the same step
|
// reference extracted variables for validation in the same step
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package tests
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCaseCallFunction(t *testing.T) {
|
func TestCaseCallFunction(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package tests
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHTTPProtocol(t *testing.T) {
|
func TestHTTPProtocol(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package tests
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRendezvous(t *testing.T) {
|
func TestRendezvous(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package tests
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCaseBasicRequest(t *testing.T) {
|
func TestCaseBasicRequest(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package tests
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCaseValidateStep(t *testing.T) {
|
func TestCaseValidateStep(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package tests
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/hrp"
|
"github.com/httprunner/httprunner/v4/hrp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCaseConfigVariables(t *testing.T) {
|
func TestCaseConfigVariables(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user