mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-06 07:57:27 +08:00
change: update tests format
This commit is contained in:
+1
-1
@@ -102,7 +102,7 @@ func (b *HRPBoomer) convertBoomerTask(testcase *TestCase, rendezvousList []*Rend
|
|||||||
|
|
||||||
var parameterVariables map[string]interface{}
|
var parameterVariables map[string]interface{}
|
||||||
// iterate through all parameter iterators and update case variables
|
// 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() {
|
if it.HasNext() {
|
||||||
parameterVariables = it.Next()
|
parameterVariables = it.Next()
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-9
@@ -763,28 +763,41 @@ func TestParseParameters(t *testing.T) {
|
|||||||
{
|
{
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"username-password": fmt.Sprintf("${parameterize(%s/account.csv)}", hrpExamplesDir),
|
"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,
|
6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"username-password": [][]interface{}{{"test1", "111111"}, {"test2", "222222"}, {"test3", "333333"}},
|
"username-password": [][]interface{}{
|
||||||
|
{"test1", "111111"},
|
||||||
|
{"test2", "222222"},
|
||||||
|
{"test3", "333333"},
|
||||||
|
},
|
||||||
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"},
|
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"},
|
||||||
"app_version": []interface{}{0.3}},
|
"app_version": []interface{}{0.3},
|
||||||
|
},
|
||||||
6,
|
6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"username-password": [][]interface{}{{"test1", "111111"}, {"test2", "222222"}, {"test3", "333333"}},
|
"username-password": [][]interface{}{
|
||||||
|
{"test1", "111111"},
|
||||||
|
{"test2", "222222"},
|
||||||
|
{"test3", "333333"},
|
||||||
|
},
|
||||||
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"},
|
"user_agent": []interface{}{"IOS/10.1", "IOS/10.2"},
|
||||||
"app_version": []interface{}{0.3, 0.4, 0.5}},
|
"app_version": []interface{}{0.3, 0.4, 0.5},
|
||||||
|
},
|
||||||
18,
|
18,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
map[string]interface{}{}, 0,
|
map[string]interface{}{},
|
||||||
|
0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nil, 0,
|
nil,
|
||||||
|
0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, data := range testData {
|
for _, data := range testData {
|
||||||
@@ -832,7 +845,10 @@ func TestParseSlice(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"username-password",
|
"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{}{
|
[]map[string]interface{}{
|
||||||
{"username": "test1", "password": 111111},
|
{"username": "test1", "password": 111111},
|
||||||
{"username": "test2", "password": 222222},
|
{"username": "test2", "password": 222222},
|
||||||
@@ -840,7 +856,10 @@ func TestParseSlice(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"username-password",
|
"username-password",
|
||||||
[][]string{{"test1", "111111"}, {"test2", "222222"}},
|
[][]string{
|
||||||
|
{"test1", "111111"},
|
||||||
|
{"test2", "222222"},
|
||||||
|
},
|
||||||
[]map[string]interface{}{
|
[]map[string]interface{}{
|
||||||
{"username": "test1", "password": "111111"},
|
{"username": "test1", "password": "111111"},
|
||||||
{"username": "test2", "password": "222222"},
|
{"username": "test2", "password": "222222"},
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ type SessionRunner struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *SessionRunner) resetSession() {
|
func (r *SessionRunner) resetSession() {
|
||||||
log.Info().Msg("clear session runner")
|
log.Info().Msg("reset session runner")
|
||||||
r.sessionVariables = make(map[string]interface{})
|
r.sessionVariables = make(map[string]interface{})
|
||||||
r.transactions = make(map[string]map[transactionType]time.Time)
|
r.transactions = make(map[string]map[transactionType]time.Time)
|
||||||
r.startTime = time.Now()
|
r.startTime = time.Now()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import builtins
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from typing import Any, Callable, Dict, List, Set, Text
|
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 loguru import logger
|
||||||
from sentry_sdk import capture_exception
|
from sentry_sdk import capture_exception
|
||||||
|
|||||||
Reference in New Issue
Block a user