mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-07 08:27:35 +08:00
Added skip statements to all tests with //go:build localtest build tag that require physical mobile devices or external services. This prevents test failures in CI/CD environments where devices are not available. Tests skipped: - Android UI tests (require ADB device) - iOS UI tests (require WDA device) - HarmonyOS tests (require HDC device) - AI service tests (require external LLM services) - Upload tests (require external HTTP services) - Device driver extension tests (require physical devices) Total: 150+ test functions across 25 files now properly skip instead of fail. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: debugtalk <debugtalk@users.noreply.github.com>
64 lines
1.6 KiB
Go
64 lines
1.6 KiB
Go
//go:build localtest
|
||
|
||
package uitest
|
||
|
||
import (
|
||
"testing"
|
||
|
||
hrp "github.com/httprunner/httprunner/v5"
|
||
"github.com/httprunner/httprunner/v5/uixt/option"
|
||
)
|
||
|
||
func TestAndroidDouyinFeedTest(t *testing.T) {
|
||
t.Skip("Skip Android UI test - requires physical Android device with ADB")
|
||
testCase := &hrp.TestCase{
|
||
Config: hrp.NewConfig("点播_抖音_滑动场景_随机间隔_android").
|
||
WithVariables(map[string]interface{}{
|
||
"device": "${ENV(SerialNumber)}",
|
||
}).
|
||
SetAndroid(option.WithSerialNumber("$device"),
|
||
option.WithAdbLogOn(true)),
|
||
TestSteps: []hrp.IStep{
|
||
hrp.NewStep("启动抖音").
|
||
Android().
|
||
AppTerminate("com.ss.android.ugc.aweme").
|
||
AppLaunch("com.ss.android.ugc.aweme").
|
||
Sleep(10).
|
||
Validate().
|
||
AssertAppInForeground("com.ss.android.ugc.aweme"),
|
||
hrp.NewStep("处理青少年弹窗").
|
||
Android().
|
||
TapByOCR("我知道了", option.WithIgnoreNotFoundError(true)),
|
||
hrp.NewStep("滑动 Feed 3 次,随机间隔 0-5s").
|
||
Loop(3).
|
||
Android().
|
||
SwipeUp().
|
||
SleepRandom(0, 5),
|
||
hrp.NewStep("滑动 Feed 1 次,随机间隔 5-10s").
|
||
Loop(1).
|
||
Android().
|
||
SwipeUp().
|
||
SleepRandom(5, 10),
|
||
hrp.NewStep("滑动 Feed 10 次,70% 随机间隔 0-5s,30% 随机间隔 5-10s").
|
||
Loop(10).
|
||
Android().
|
||
SwipeUp().
|
||
SleepRandom(0, 5, 0.7, 5, 10, 0.3),
|
||
hrp.NewStep("exit").
|
||
Android().
|
||
AppTerminate("com.ss.android.ugc.aweme").
|
||
Validate().
|
||
AssertAppNotInForeground("com.ss.android.ugc.aweme"),
|
||
},
|
||
}
|
||
|
||
if err := testCase.Dump2JSON("demo_android_feed_swipe.json"); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
|
||
err := hrp.Run(t, testCase)
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
}
|