adb_test.go 618 B

12345678910111213141516171819202122232425262728293031
  1. package tests
  2. import (
  3. "testing"
  4. "notabug.org/Umnik/GoAndroidSDK/v2/components/sdk/platformTools/adb"
  5. )
  6. func newAdb(t *testing.T) *adb.Adb {
  7. t.Helper()
  8. adbTool, err := adb.NewAdbFromSdk(*newSdk(t, t.Name()))
  9. if !testErr(t, t.Name(), err) {
  10. return nil
  11. }
  12. return adbTool
  13. }
  14. func TestDevices(t *testing.T) {
  15. adbTool := newAdb(t)
  16. devices := adbTool.ConnectedDevices()
  17. if len(devices) < 1 {
  18. t.Error("No any device/emulator found")
  19. } else {
  20. for i, val := range devices {
  21. if len(val.Serial()) < 12 {
  22. t.Errorf("bad device serial: %q (device %d of %d)", val.Serial(), i+1, len(devices))
  23. }
  24. }
  25. }
  26. }