mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-17 07:17:36 +08:00
change: update example yanglegeyang
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"config": {
|
||||
"name": "羊了个羊小游戏自动化测试",
|
||||
"variables": {
|
||||
"package_name": "com.ss.android.ugc.aweme"
|
||||
},
|
||||
"ai_options": {
|
||||
"llm_service": "doubao-1.5-thinking-vision-pro-250428"
|
||||
}
|
||||
@@ -13,7 +16,7 @@
|
||||
"actions": [
|
||||
{
|
||||
"method": "app_launch",
|
||||
"params": "com.ss.android.ugc.aweme"
|
||||
"params": "$package_name"
|
||||
},
|
||||
{
|
||||
"method": "sleep",
|
||||
@@ -25,8 +28,8 @@
|
||||
{
|
||||
"check": "ui_foreground_app",
|
||||
"assert": "equal",
|
||||
"expect": "com.ss.android.ugc.aweme",
|
||||
"msg": "app [com.ss.android.ugc.aweme] should be in foreground"
|
||||
"expect": "$package_name",
|
||||
"msg": "app [$package_name] should be in foreground"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -68,6 +71,18 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "退出抖音 app",
|
||||
"android": {
|
||||
"os_type": "android",
|
||||
"actions": [
|
||||
{
|
||||
"method": "app_terminate",
|
||||
"params": "$package_name"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -28,14 +28,17 @@ func TestGameYanglegeyang(t *testing.T) {
|
||||
|
||||
testCase := &hrp.TestCase{
|
||||
Config: hrp.NewConfig("羊了个羊小游戏自动化测试").
|
||||
SetLLMService(option.DOUBAO_1_5_THINKING_VISION_PRO_250428),
|
||||
SetLLMService(option.DOUBAO_1_5_THINKING_VISION_PRO_250428).
|
||||
WithVariables(map[string]interface{}{
|
||||
"package_name": "com.ss.android.ugc.aweme",
|
||||
}),
|
||||
TestSteps: []hrp.IStep{
|
||||
hrp.NewStep("启动抖音 app").
|
||||
Android().
|
||||
AppLaunch("com.ss.android.ugc.aweme").
|
||||
AppLaunch("$package_name").
|
||||
Sleep(5).
|
||||
Validate().
|
||||
AssertAppInForeground("com.ss.android.ugc.aweme"),
|
||||
AssertAppInForeground("$package_name"),
|
||||
hrp.NewStep("进入「羊了个羊」小游戏").
|
||||
Android().
|
||||
StartToGoal("搜索「羊了个羊星球」,进入小程序,加入羊群进入游戏",
|
||||
@@ -47,6 +50,9 @@ func TestGameYanglegeyang(t *testing.T) {
|
||||
StartToGoal(userInstruction,
|
||||
option.WithPreMarkOperation(true),
|
||||
option.WithTimeout(300)), // 5 minutes
|
||||
hrp.NewStep("退出抖音 app").
|
||||
Android().
|
||||
AppTerminate("$package_name"),
|
||||
},
|
||||
}
|
||||
err := testCase.Dump2JSON("game_yanglegeyang.json")
|
||||
|
||||
Reference in New Issue
Block a user