Merge branch 'master' into ios-wda

This commit is contained in:
debugtalk
2022-08-15 21:21:32 +08:00
25 changed files with 1162 additions and 229 deletions

View File

@@ -17,6 +17,7 @@ import (
"github.com/rs/zerolog/log"
"golang.org/x/net/http2"
"github.com/httprunner/funplugin"
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
)
@@ -190,11 +191,12 @@ func (r *HRPRunner) Run(testcases ...ITestCase) error {
// quit all plugins
defer func() {
if len(pluginMap) > 0 {
for _, plugin := range pluginMap {
pluginMap.Range(func(key, value interface{}) bool {
if plugin, ok := value.(funplugin.IPlugin); ok {
plugin.Quit()
}
}
return true
})
}()
var runErr error
@@ -287,15 +289,17 @@ func (r *HRPRunner) newCaseRunner(testcase *TestCase) (*testCaseRunner, error) {
// load plugin info to testcase config
if plugin != nil {
pluginPath, _ := locatePlugin(testcase.Config.Path)
pluginContent, err := builtin.ReadFile(pluginPath)
if err != nil {
return nil, err
}
tp := strings.Split(plugin.Path(), ".")
runner.parsedConfig.PluginSetting = &PluginConfig{
Path: pluginPath,
Content: pluginContent,
Type: tp[len(tp)-1],
if runner.parsedConfig.PluginSetting == nil {
pluginContent, err := builtin.ReadFile(pluginPath)
if err != nil {
return nil, err
}
tp := strings.Split(plugin.Path(), ".")
runner.parsedConfig.PluginSetting = &PluginConfig{
Path: pluginPath,
Content: pluginContent,
Type: tp[len(tp)-1],
}
}
}