mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-26 01:51:29 +08:00
change: add tests
This commit is contained in:
@@ -1 +1 @@
|
||||
v5.0.0-beta-2504271150
|
||||
v5.0.0-beta-2504271913
|
||||
|
||||
@@ -57,7 +57,7 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
defaultTimeout = 60 * time.Second
|
||||
defaultTimeout = 30 * time.Second
|
||||
)
|
||||
|
||||
// Error types
|
||||
|
||||
@@ -195,6 +195,53 @@ func TestChatList(t *testing.T) {
|
||||
require.NotNil(t, result)
|
||||
}
|
||||
|
||||
func TestHandleSwitch(t *testing.T) {
|
||||
userInstruction := "发送框下方的联网搜索开关是开启状态" // 点击开启联网搜索开关
|
||||
// 检查发送框下方的联网搜索开关,蓝色为开启状态,灰色为关闭状态;若开关处于关闭状态,则点击进行开启
|
||||
|
||||
planner, err := NewUITarsPlanner(context.Background())
|
||||
require.NoError(t, err)
|
||||
|
||||
testCases := []struct {
|
||||
imageFile string
|
||||
actionType ActionType
|
||||
}{
|
||||
{"testdata/deepseek_think_off.png", ActionTypeClick},
|
||||
{"testdata/deepseek_think_on.png", ActionTypeFinished},
|
||||
{"testdata/deepseek_network_on.png", ActionTypeFinished},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
imageBase64, size, err := loadImage(tc.imageFile)
|
||||
require.NoError(t, err)
|
||||
|
||||
opts := &PlanningOptions{
|
||||
UserInstruction: userInstruction,
|
||||
Message: &schema.Message{
|
||||
Role: schema.User,
|
||||
MultiContent: []schema.ChatMessagePart{
|
||||
{
|
||||
Type: schema.ChatMessagePartTypeImageURL,
|
||||
ImageURL: &schema.ChatMessageImageURL{
|
||||
URL: imageBase64,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Size: size,
|
||||
}
|
||||
|
||||
// Execute planning
|
||||
result, err := planner.Call(opts)
|
||||
|
||||
// Validate results
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, result)
|
||||
require.Equal(t, result.NextActions[0].ActionType, tc.actionType,
|
||||
"Unexpected action type for image file: %s", tc.imageFile)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateInput(t *testing.T) {
|
||||
imageBase64, size, err := loadImage("testdata/popup_risk_warning.png")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -44,13 +44,22 @@ func GetArkModelConfig() (*ark.ChatModelConfig, error) {
|
||||
"env %s missed", EnvArkModelID)
|
||||
}
|
||||
timeout := defaultTimeout
|
||||
temp := float32(0.7)
|
||||
|
||||
// https://www.volcengine.com/docs/82379/1494384?redirect=1
|
||||
temperature := float32(0.01) // [0, 2] 采样温度。控制了生成文本时对每个候选词的概率分布进行平滑的程度。
|
||||
// topP := float32(0.7) // [0, 1] 核采样概率阈值。模型会考虑概率质量在 top_p 内的 token 结果。
|
||||
// maxTokens := int(4096) // 模型可以生成的最大 token 数量。输入 token 和输出 token 的总长度还受模型的上下文长度限制。
|
||||
// frequencyPenalty := float32(0) // [-2, 2] 频率惩罚系数。如果值为正,会根据新 token 在文本中的出现频率对其进行惩罚,从而降低模型逐字重复的可能性。
|
||||
|
||||
modelConfig := &ark.ChatModelConfig{
|
||||
BaseURL: arkBaseURL,
|
||||
APIKey: arkAPIKey,
|
||||
Model: modelName,
|
||||
Temperature: &temp,
|
||||
Timeout: &timeout,
|
||||
Temperature: &temperature,
|
||||
// TopP: &topP,
|
||||
// MaxTokens: &maxTokens,
|
||||
// FrequencyPenalty: &frequencyPenalty,
|
||||
}
|
||||
|
||||
// log config info
|
||||
|
||||
BIN
uixt/ai/testdata/deepseek_network_on.png
vendored
Normal file
BIN
uixt/ai/testdata/deepseek_network_on.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 377 KiB |
BIN
uixt/ai/testdata/deepseek_think_off.png
vendored
Normal file
BIN
uixt/ai/testdata/deepseek_think_off.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 371 KiB |
BIN
uixt/ai/testdata/deepseek_think_on.png
vendored
Normal file
BIN
uixt/ai/testdata/deepseek_think_on.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 369 KiB |
Reference in New Issue
Block a user