• Stars
    star
    275
  • Rank 144,486 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 12 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

On-demand screenshots for your Android integration tests

Android Screenshot library

On-demand screenshots during Android integration tests

This framework uses ddmlib to capture screenshots from your device, and addresses some issues around taking screenshots with ddmlib:

  • ddmlib image capture is slow, around 600ms+ per image
  • if the device screen is updating, the captured image is likely to show a partially-updated framebuffer
  • ddmlib is invoked on the development environment side of your setup (ie your machine executing the Maven build) - your app code can't easily take screenshots itself, but in order to get best screenshot results your device screen should not be changing when the screenshot is taken

How it works

The system is in two parts, paparazzo & celebrity. Crucially, the paparazzo only takes photos when the celebrity asks.

  • paparazzo - taking the photos : your desktop development environment runs an OnDemandScreenshotService, using ddmlib to listen for log messages tagged with the special tag screenshot_request.
  • celebrity - the subject being photographed : your Android device runs your integration tests as it would normally, just writing a screenshot_request log message whenever it wants a screenshot taken - the paparazzo service then obliges by capturing an image from the device.

To get the best results, your test code should pause for a second after writing the log message, so that the screenshot is of a stationary screen. That simple operation is wrapped up for convenience in the Screenshots class packaged into the android-screenshot-celebrity artifact - but you don't have to use it, if you want to write the log-and-sleeping statements yourself.

Usage (for app developers)

Your app is the celebrity here - add poseForScreenshot() calls to your Android integration tests wherever you want a screenshot taken.

See this example robotium test from the open-source Gaug.es android app by GitHub - once the build finishes, the resulting animated-gif looks like this:

animated gif

You'll need to ensure that you're using a build system (ie Maven) that includes the paparazzo OnDemandScreenshotService. If you're not, there'll be no negative effect - you're just writing log messages - but no screenshots will be taken.

Build systems

The android-maven plugin will include support for android-screenshot-lib as of v3.1.2, capturing screenshots during the integration-tests step. (pull-request 104)

Not to be confused with...

android-screenshot-library hosted on Google Code. Despite the names being very similar (apologies for that) this is a different library that takes a different non-ddmlib-based approach. It requires slightly more intrusive changes to your app.

More Repositories

1

bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
Scala
10,666
star
2

agit

Agit - Git client for Android
Java
489
star
3

roboguice-sherlock

RoboGuice classes extending ActionBarSherlock classes
Java
336
star
4

animated-gif-lib-for-java

A re-package of the Animated GIF processing classes made available by Kevin Weiner at http://www.fmsware.com/stuff/gif.html
Java
155
star
5

spongycastle-old

The Old repo for Spongy Castle - see rtyley/spongycastle instead!
Java
85
star
6

submitgit

send pull requests to the Git mailing list
Scala
47
star
7

android-pinned-header-listviews

A 'Pinned Header' library for ExpandableListViews on Android
Java
46
star
8

mini-git-server

pure-Java WAR capable of hosting git repos and exposing them with git+ssh. Basically a stripped-down copy of Gerrit
Java
40
star
9

android-viewholder-listviews

A small framework to make using the 'ViewHolder' pattern a bit clearer
Java
33
star
10

jsch

Rough import of JSch release history into git for playing with
Java
27
star
11

scala-git

small Scala veneer over JGit
Scala
21
star
12

spongycastle-eclipse

Java
17
star
13

lazy-drawables

A framework for loading/displaying images asynchronously in Android - released under Apache Licence v2
Java
17
star
14

small-test-repo

10
star
15

glug

A log visualizer for multi-threaded systems
Java
8
star
16

toy-android-ssh-agent

Totally insecure proof of concept!
Java
8
star
17

wordle-scala

Wordle Solving in Scala
Scala
7
star
18

use-newer-java

A small helper library to give users a friendly message when they're using a version of Java that's too old
Java
6
star
19

JNA-USB

Exploratory code, working out how to write a Java USB driver for my Garmin Forerunner 305 using JNA rather than JNI
Java
6
star
20

defer-for-java-google-app-engine

Java
3
star
21

play-git-hub

common library of Play/Scala code for creating GitHub-related webapps
Scala
3
star
22

madgag-ssh

Libraries around SSH (specifically SSH-Agent interface)
Java
3
star
23

ToodleBye

JavaScript
3
star
24

scala-textmatching

Unifying simple globs, regex & literal matchers for Scala
Scala
3
star
25

line-break-preserving-line-splitting

Scala
3
star
26

Dave-the-Lion-Tamer

video short edited using Kdenlive
2
star
27

madgag-hamcrest-matchers

just some hamcrest matchers I find useful
Java
2
star
28

test-bc-java-cvsimport

git cvsimport -d :pserver:[email protected]:/home/users/bouncy/cvsroot java
Java
2
star
29

which-repos-had-these-contributors

Which repos in a given GitHub Organisation received contributions from the specified users?
Scala
2
star
30

inactive-private-repos

Scala
1
star
31

av-footle

Scala
1
star
32

scala-collection-plus

a few extras to handle Scala 2.13's deprecation of `.mapValues()`
Scala
1
star
33

lego-tardis

Python
1
star
34

freshwiki

1
star
35

nio-files-exists-perf

Java
1
star
36

multi-project-build-mixing-scala-3-and-scala-2

Scala
1
star
37

hospital-bugs

Java
1
star
38

bfg-bench

A quick packaging of my BFG benchmark tool for the JGit team
1
star
39

playground

1
star
40

globs-for-java

A Java Glob implementation taken from OpenJDK 7 sun.nio.fs.Globs
Java
1
star
41

sound-the-alert

Python
1
star
42

madgag-util

Java
1
star
43

downstairs-mirror

Arduino sketch for a remote control embedded in a book-shaped tin
Arduino
1
star
44

test-git-lfs

1
star
45

gu-content-api-client

Java
1
star
46

intellij-git-lfs-demo

1
star
47

gs

footling with GitHub API in the Scala console
Scala
1
star
48

five-mb-file-test-repo

Test repo for issue 47 in Agit
1
star
49

test-ga

Java
1
star
50

rtyley.github.io

CSS
1
star
51

time-treasure

Python
1
star
52

realtime-signups

scala.js, server-sent events, kinesis streams
Scala
1
star
53

levenshtein

Scala
1
star
54

lagger-test

1
star
55

repo-with-symlinks

1
star
56

rate-limit-status

For understanding just how badly you're exceeding your API quota...
Scala
1
star
57

teamcity-sbt

Scratch code - probably doesn't even compile
Java
1
star
58

mirror

C
1
star
59

solder-fume-extractor

Arduino-acitvated solder-fume-extractor, triggered by picking up the soldering iron
Arduino
1
star
60

dont-blink

A Weeping Angel widget for your Android home screen.
Java
1
star
61

github-api-test

a test repository used to test kohsuke's github-api
1
star
62

jgit-git-lfs-demo

Java
1
star
63

great-run-results-scraper

Extracts the data from the Great Run race results at http://raceresults.greatrun.org/ so you can have them in regular spreadsheet form like http://spreadsheets.google.com/pub?key=teUGTAScuow_ygRV4tn4pqw&single=true&gid=0&output=html
Java
1
star