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