forked from square/spoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
218 lines (199 loc) · 12.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Spoon</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Distributing instrumentation tests to all your Androids">
<link href="static/bootstrap-combined.min.css" rel="stylesheet">
<link href="static/app.css" rel="stylesheet">
<link href="static/app-theme.css" rel="stylesheet">
<link href="http://fonts.googleapis.com/css?family=Roboto:400,300italic,100,100italic,300" rel="stylesheet" type="text/css">
<!--[if lt IE 9]><script src="static/html5shiv.min.js"></script><![endif]-->
</head>
<body data-target=".content-nav">
<header>
<div class="container">
<div class="row">
<div class="span5">
<h1>Spoon</h1>
</div>
<div class="span7">
<menu>
<ul>
<li><a href="#download" class="menu download">Download <span class="version-tag">Latest</span></a></li>
<li><a href="http://github.com/square/spoon" data-title="View GitHub Project" class="menu github"><img src="static/icon-github.png" alt="GitHub"/></a></li>
<li><a href="http://square.github.io/" data-title="Square Open Source Portal" class="menu square"><img src="static/icon-square.png" alt="Square"/></a></li>
</ul>
</menu>
</div>
</div>
</header>
<section id="subtitle">
<div class="container">
<div class="row">
<div class="span12">
<h2>Distributing <strong>instrumentation tests</strong> to all your Androids</h2>
</div>
</div>
</div>
</section>
<section id="body">
<div class="container">
<div class="row">
<div class="span9">
<h3 id="introduction">Introduction</h3>
<p>Android's ever-expanding ecosystem of devices creates a unique challenge to testing applications. Spoon aims to simplify this task by distributing instrumentation test execution and displaying the results in a meaningful way.</p>
<p>Instead of attempting to be a new form of testing, Spoon makes existing instrumentation tests more useful. Using the application APK and instrumentation APK, Spoon runs the tests on multiple devices simultaneously. Once all tests have completed, a static HTML summary is generated with detailed information about each device and test.</p>
<p><img src="static/example_main.png" alt="Example output"></p>
<p>With the high-level output you can immediately see whether or not a test failure is specific to a single device or all devices. This view is designed to be displayed on a dedicated monitor or TV.</p>
<img src="static/device_cluster.png" class="pull-right">
<p>Spoon will run on all targets which are visible to <code>adb devices</code>. Plug in multiple different phones and tablets, start different configurations of emulators, or use some combination of both!</p>
<p>The greater diversity of the targets in use, the more useful the output will be in visualizing your applications.</p>
<h4 id="device-view">Device View</h4>
<p>The device view outlines the results of each test one a single device. This is useful for tracking down device-specific failures of individual tests.</p>
<p><img src="static/example_device_view.png" alt="Example device view"></p>
<h4 id="test-view">Test View</h4>
<p>The test view shows the results of a single test across all of the devices it was executed on.</p>
<p><img src="static/example_test_view.png" alt="Example test view"></p>
<h4 id="screenshots">Screenshots</h4>
<p>In addition to simply running instrumentation tests, Spoon has the ability to snap screenshots at key points during your tests which are then included in the output. This allows for visual inspection of test executions across different devices.</p>
<p>Taking screenshots requires that you include the <code>spoon-client</code> JAR in your instrumentation app. In your tests call the <code>screenshot</code> method with a human-readable tag.</p>
<pre class="prettyprint">Spoon.screenshot(activity, "initial_state");
/* Normal test code... */
Spoon.screenshot(activity, "after_login");</pre>
<p>The tag specified will be used to identify and compare screenshots taken across multiple test runs.</p>
<p>Screenshots are displayed in order in both the device view and the test view:</p>
<p><img src="static/example_screenshots.png" alt="Sample output with screenshots"></p>
<p>You can also view each test's screenshots as an animated GIF to gauge the actual sequence of interaction.</p>
<h3 id="download">Download</h3>
<p><a href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.squareup.spoon&a=spoon-runner&v=LATEST&c=jar-with-dependencies" class="dl runner-version-href">↓ <span class="version-tag">Latest</span> Runner JAR</a> <a href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.squareup.spoon&a=spoon-client&v=LATEST" class="dl client-version-href">↓ <span class="version-tag">Latest</span> Client JAR</a></p>
<p>The source code to the runner, client library, and sample applications as well as this website is <a href="http://github.com/square/spoon">available on GitHub</a>.</p>
<h4>Maven</h4>
<p>If you are using Maven for compilation you can declare the screenshot library as a dependency.</p>
<pre class="prettyprint"><dependency>
<groupId>com.squareup.spoon</groupId>
<artifactId>spoon-client</artifactId>
<version><span class="version pln"><em>(insert latest version)</em></span></version>
</dependency></pre>
<h4 id="sample">Sample</h4>
<p>Included with Spoon is a sample application and instrumentation tests to demonstrate both the usage as well as provide an example of the output.</p>
<p>The sample shows a simple login screen and an ordering wizard run on a few devices. The application and tests have been constructed so that some have broken styles or will fail on various devices. This was done to give a better idea of what the real-world output looks like.</p>
<p><a href="sample/index.html">View sample execution output »</a></p>
<h3 id="execution">Execution</h3>
<p>Spoon was designed to be run both as a standalone tool or directly as part of your build system.</p>
<h4 id="cli">Command Line</h4>
<p>You can run Spoon as a standalone tool with your application and instrumentation APKs.</p>
<pre>java -jar spoon-runner-1.0.0-jar-with-dependencies.jar \
--apk example-app.apk \
--test-apk example-tests.apk</pre>
<p>By default the output will be placed in a <code>spoon-output/</code> folder of the current directory. You can control additional parameters of the execution using other flags.</p>
<pre>Options:
--apk Application APK
--fail-on-failure Non-zero exit code on failure
--output Output path
--sdk Path to Android SDK
--test-apk Test application APK
--title Execution title
--class-name Test class name to run (fully-qualified)
--method-name Test method name to run (must also use --class-name)</pre>
<h4 id="maven">Maven</h4>
<p>If you are using Maven for compilation, a plugin is provided for easy execution. Declare the plugin in the <code>pom.xml</code> for the instrumentation test module.</p>
<pre class="prettyprint"><plugin>
<groupId>com.squareup.spoon</groupId>
<artifactId>spoon-maven-plugin</artifactId>
<version><span class="version pln"><em>(insert latest version)</em></span></version>
</plugin></pre>
<p>The plugin will look for an <code>apk</code> dependency for the corresponding application. Typically this is specified in parallel with the <code>jar</code> dependency on the application.</p>
<pre class="prettyprint"><dependency>
<groupId>com.example</groupId>
<artifactId>example-app</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>provied</scope>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>example-app</artifactId>
<version>${project.version}</version>
<type>apk</type>
<scope>provied</scope>
</dependency></pre>
<p>You can invoke the plugin by running <code>mvn spoon:run</code>. The execution result will be placed in the <code>target/spoon-output/</code> folder. If you want to specify a test class to run, add <code>-Dspoon.test.class=fully.qualified.ClassName</code>. If you only want to run a single test in that class, add <code>-Dspoon.test.method=testAllTheThings.</code></p>
<p>For a working example see the sample application and instrumentation tests in the <code>spoon-sample/</code> folder.</p>
<h3 id="contributing">Contributing</h3>
<p>If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request.</p>
<p>When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. Please also make sure your code compiles by running <code>mvn clean verify</code>.</p>
<p>Before your code can be accepted into the project you must also sign the <a href="http://squ.re/sign-the-cla">Individual Contributor License Agreement (CLA)</a>.</p>
<h3 id="license">License</h3>
<pre>Copyright 2013 Square, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.</pre>
</div>
<div class="span3">
<div class="content-nav" data-spy="affix" data-offset-top="80">
<ul class="nav nav-tabs nav-stacked primary">
<li><a href="#introduction">Introduction</a></li>
<li><a href="#download">Download</a></li>
<li><a href="#execution">Execution</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
</ul>
<ul class="nav nav-pills nav-stacked secondary">
<li><a href="https://plus.google.com/communities/109244258569782858265/stream/c958038c-58cb-4250-b2ff-676db4028b6b">Google+ Community</a></li>
<li><a href="sample/index.html">Sample Output</a></li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="span12 logo">
<a href="https://squareup.com"><img src="static/logo-square.png" alt="Square, Inc."/></a>
</div>
</div>
</div>
</section>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="static/bootstrap.min.js"></script>
<script src="static/jquery.smooth-scroll.min.js"></script>
<script src="static/jquery-maven-artifact.min.js"></script>
<script src="static/prettify.js"></script>
<script type="text/javascript">
$(function() {
// Syntax highlight code blocks.
prettyPrint();
// Spy on scroll position for real-time updating of current section.
$('body').scrollspy();
// Use smooth-scroll for internal links.
$('a').smoothScroll();
// Enable tooltips on the header nav image items.
$('.menu').tooltip({
placement: 'bottom',
trigger: 'hover',
container: 'body',
delay: {
show: 500,
hide: 0
}
});
// TODO support classifiers!
// $.fn.artifactVersion('com.squareup.spoon', 'spoon-runner', function(version, url) {
// $('.runner-version').text('v' + version);
// $('.runner-href').attr('href', url);
// });
$.fn.artifactVersion('com.squareup.spoon', 'spoon-client', function(version, url) {
$('.version').text(version);
$('.version-tag').text('v' + version);
$('.client-version-href').attr('href', url);
});
});
</script>
</body>
</html>