Skip to content
Open

WIP #13

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#goadb

[![Build Status](https://travis-ci.org/zach-klippenstein/goadb.svg?branch=master)](https://travis-ci.org/zach-klippenstein/goadb)
[![GoDoc](https://godoc.org/github.com/zach-klippenstein/goadb?status.svg)](https://godoc.org/github.com/zach-klippenstein/goadb)

Unit Tests: [![Build Status](https://travis-ci.org/zach-klippenstein/goadb.svg?branch=master)](https://travis-ci.org/zach-klippenstein/goadb)

Integration Tests: [![Circle CI](https://circleci.com/gh/zach-klippenstein/goadb.svg?style=shield)](https://circleci.com/gh/zach-klippenstein/goadb)

A Golang library for interacting with the Android Debug Bridge (adb).

See [demo.go](cmd/demo/demo.go) for usage.
26 changes: 26 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Build configuration for Circle CI
#

machine:
environment:
GO15VENDOREXPERIMENT: 1
ANDROID_HOME: /usr/local/android-sdk-linux

dependencies:
post:
- go get -u github.com/jstemmer/go-junit-report

test:
pre:
- go version
- emulator -avd circleci-android23 -no-audio -no-window:
background: true
parallel: true
- circle-android wait-for-boot

override:
# Circle requires test results to be in JUnit's XML format.
- mkdir -p $CIRCLE_TEST_REPORTS/junit
- go test -v ./internal/integrationtests/... | go-junit-report > $CIRCLE_TEST_REPORTS/junit/test-results.xml:
timeout: 600
34 changes: 34 additions & 0 deletions internal/integrationtests/integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package integrationtests

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zach-klippenstein/goadb"
)

func TestListDevices(t *testing.T) {
server, err := adb.NewServer(adb.ServerConfig{})
require.NoError(t, err)
client := adb.NewHostClient(server)

devices, err := client.ListDevices()
require.NoError(t, err)
assert.Len(t, devices, 1)
t.Logf("Found %d devices:", len(devices))
for _, device := range devices {
t.Logf("%s\tusb:%s product:%s model:%s device:%s\n",
device.Serial, device.Usb, device.Product, device.Model, device.DeviceInfo)
}
}

func TestShell(t *testing.T) {
server, err := adb.NewServer(adb.ServerConfig{})
require.NoError(t, err)
client := adb.NewDeviceClient(server, adb.AnyDevice())

output, err := client.RunCommand("echo", "hello world")
require.NoError(t, err)
require.Equal(t, "hello world", output)
}