change: update tests format

This commit is contained in:
debugtalk
2022-04-13 17:45:51 +08:00
parent 55e4ad89c8
commit 14bad9e5c3
4 changed files with 33 additions and 14 deletions

View File

@@ -102,7 +102,7 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
var parameterVariables map[string]interface{}
// iterate through all parameter iterators and update case variables
for _, it := range testcase.Config.ParametersSetting.Iterators {
for _, it := range sessionRunner.parsedConfig.ParametersSetting.Iterators {
if it.HasNext() {
parameterVariables = it.Next()
}

View File

@@ -763,28 +763,41 @@ func TestParseParameters(t *testing.T) {
{
map[string]interface{}{
"username-password": fmt.Sprintf("${parameterize(%s/account.csv)}", hrpExamplesDir),
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"}},
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"},
},
6,
},
{
map[string]interface{}{
"username-password": [][]interface{}{{"test1", "111111"}, {"test2", "222222"}, {"test3", "333333"}},
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"},
"app_version": []interface{}{0.3}},
"username-password": [][]interface{}{
{"test1", "111111"},
{"test2", "222222"},
{"test3", "333333"},
},
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"},
"app_version": []interface{}{0.3},
},
6,
},
{
map[string]interface{}{
"username-password": [][]interface{}{{"test1", "111111"}, {"test2", "222222"}, {"test3", "333333"}},
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"},
"app_version": []interface{}{0.3, 0.4, 0.5}},
"username-password": [][]interface{}{
{"test1", "111111"},
{"test2", "222222"},
{"test3", "333333"},
},
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"},
"app_version": []interface{}{0.3, 0.4, 0.5},
},
18,
},
{
map[string]interface{}{}, 0,
map[string]interface{}{},
0,
},
{
nil, 0,
nil,
0,
},
}
for _, data := range testData {
@@ -832,7 +845,10 @@ func TestParseSlice(t *testing.T) {
}{
{
"username-password",
[]map[string]interface{}{{"username": "test1", "password": 111111, "other": "111"}, {"username": "test2", "password": 222222, "other": "222"}},
[]map[string]interface{}{
{"username": "test1", "password": 111111, "other": "111"},
{"username": "test2", "password": 222222, "other": "222"},
},
[]map[string]interface{}{
{"username": "test1", "password": 111111},
{"username": "test2", "password": 222222},
@@ -840,7 +856,10 @@ func TestParseSlice(t *testing.T) {
},
{
"username-password",
[][]string{{"test1", "111111"}, {"test2", "222222"}},
[][]string{
{"test1", "111111"},
{"test2", "222222"},
},
[]map[string]interface{}{
{"username": "test1", "password": "111111"},
{"username": "test2", "password": "222222"},

View File

@@ -25,7 +25,7 @@ type SessionRunner struct {
}
func (r *SessionRunner) resetSession() {
log.Info().Msg("clear session runner")
log.Info().Msg("reset session runner")
r.sessionVariables = make(map[string]interface{})
r.transactions = make(map[string]map[transactionType]time.Time)
r.startTime = time.Now()

View File

@@ -3,7 +3,7 @@ import builtins
import os
import re
from typing import Any, Callable, Dict, List, Set, Text
from urllib.parse import urljoin, urlparse
from urllib.parse import urlparse
from loguru import logger
from sentry_sdk import capture_exception