forked from mrjohannchang/slides-unit-testig-in-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
242 lines (207 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Unit Testing in Android</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="reveal.js/css/reveal.min.css">
<link rel="stylesheet" href="reveal.js/css/theme/default.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="reveal.js/lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="reveal.js/css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<style type="text/css">
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
text-transform: none; }
</style>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Unit Testing in Android</h1>
<h3>Step by Step</h3>
<p>Created by <a href="mailto:[email protected]">Wig Cheng (鄭元誠)</a> and <a href="mailto:[email protected]">Chang Yu-heng (張昱珩)</a></p>
<p>2014-07-07</p>
<p>
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="assets/images/cc/cc.svg" /></a>
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="assets/images/cc/by.svg" /></a>
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="assets/images/cc/sa.svg" /></a>
</p>
</section>
<section>
<section>
<h1>Software Development Process</h1>
</section>
<section>
<h2>The V-Model</h2>
<img alt="v-model" style="border-width:0; max-height: none; max-width: none; width: 999px;" src="assets/images/v-model/the-v-model-of-the-systems-engineering-process.svg"></img>
<p style="position: absolute; z-index: 4; left: 376px; top: 518px;" class="absolute-element fragment fade-out"><font color="#000000"><span style="background-color: rgb(255, 255, 255);">Coding Unit Test</span></font></p>
<p style="position: absolute; z-index: 4; left: 399px; top: 558px;" class="absolute-element fragment">=> Test-driven development (TDD)</p>
</section>
<section>
<h2>Unit Testing</h2>
<p>An unit can be viewed as the smallest testable part of an application</p>
<ul>
<li>An entire <b>interface</b> or an individual <b>method</b> in object-oriented programming</li>
<li>An entire <b>module</b> or an individual <b>function</b>/<b>procedure</b> in procedural programming</li>
</ul>
</section>
<section>
<div style="background-color: rgb(20, 98, 135); width: 100%; height: 1080px; position: absolute; top: -100%; left: -50%; z-index: -1;"></div>
<div>
<div style="width: 40%; display: inline-block; margin-right: 5%; vertical-align: top;">
<p><font color=#FFFFFF><b>Production Code</b></font><br /><br /></p>
</div>
<div style="width: 40%; display: inline-block;">
<p><b>Test Code</b><br /><br /></p>
</div>
</div>
<div>
<div style="width: 40%; display: inline-block; margin-right: 5%; vertical-align: top;">
<p style="text-align: left; font-size: 60%;"><font style="color: #FFFFFF; font-family: monospace;">
public int sum(int x, int y) {<br /> return x + y;<br />}
</font></p>
</div>
<div style="width: 40%; display: inline-block;">
<p style="text-align: left; font-size: 60%;"><font style="font-family: monospace;">
public void testSum() {<br /> int i = sum(1, 2);<br /> assertEquals(i, 3);<br />}
</font></p>
</div>
</div>
</section>
<section>
<h2>Testing Methods</h2>
<ul>
<li>White-box testing</li>
<p class="fragment" data-fragment-index="0">The testing code is dedicated for the implementation</p>
<p class="fragment" data-fragment-index="2">Pros:</p>
<ul class="fragment" data-fragment-index="2"><li>Good coverage and implementation checking</li></ul>
<p class="fragment" data-fragment-index="2">Cons:</p>
<ul class="fragment" data-fragment-index="2"><li>High cost</li></ul>
<li>Black-box testing</li>
<p class="fragment" data-fragment-index="1">The testing code is dedicated for the interface</p>
<p class="fragment" data-fragment-index="3">Pros:</p>
<ul class="fragment" data-fragment-index="3"><li>Good for interface checking</li></ul>
<li class="fragment" data-fragment-index="4">Grey-box testing</li>
</ul>
</section>
<section>
<h2>Basic Code Coverage Criteria</h2>
<ul>
<li>Function coverage</li>
<li>Statement coverage</li>
<li>Branch coverage</li>
<li>Condition coverage</li>
</ul>
</section>
<section>
<h2><font style="text-shadow: 0 0 0.2em #FFF, 0 0 0.2em #FFF, 0 0 0.2em #FFF;">Branch Coverage</font></h2>
<div style="background-color: rgb(20, 98, 135); width: 100%; height: 1920px; position: absolute; top: -100%; left: -50%; z-index: -1;"></div>
<div>
<div style="width: 40%; display: inline-block; margin-right: 5%; vertical-align: top;">
<p><font color=#FFFFFF><b>Production Code</b></font><br /><br /></p>
</div>
<div style="width: 40%; display: inline-block; vertical-align: top;">
<p><b>Test Code</b><br /><br /></p>
</div>
</div>
<div>
<div style="width: 40%; display: inline-block; margin-right: 5%; vertical-align: top;">
<p style="text-align: left; font-size: 60%;"><font style="color: #FFFFFF; font-family: monospace;">
public int max(int x, int y) {<br /><font class="fragment highlight-current-green" data-fragment-index="0"> if (x > y)<br /> return x;<br /></font><font class="fragment highlight-current-green" data-fragment-index="2"> else<br /> return y;<br /></font>}
</font></p>
</div>
<font class="fragment" data-fragment-index="1"></font>
<div style="width: 40%; display: inline-block; vertical-align: top;">
<p style="text-align: left; font-size: 60%;"><font style="font-family: monospace;">
public void testMax() {<br /> int i = <font class="fragment highlight-current-red" data-fragment-index="0">max(2, 1)</font>;<br /> assertEquals(i, 2);<br /> i = <font class="fragment highlight-current-red" data-fragment-index="2">max(6, 9)</font>;<br /> assertEquals(i, 99);<br />}
</font></p>
</div>
</div>
</section>
</section>
<section>
<section>
<h1>Building an Unit Testing Environment</h1>
</section>
<section>
<h2>Software Requirement</h2>
<ul>
<li>JDK</li>
<li>Android SDK</li>
<li>Android Studio (IDE)</li>
<li>Genymotion (emulator)</li>
</ul>
</section>
</section>
<section>
<section>
<h1>Writing Test Cases</h1>
</section>
</section>
<section>
<section>
<h1>Testing Tools</h1>
</section>
<section>
<ul>
<li>Robolectric</li>
<p>Wouldn’t it be nice to run your Android tests directly from inside your IDE?</p>
<li>uiautomator</li>
<p>Automated functional UI test cases</p>
<li>MonkeyTalk</li>
<p>Capture and replay the test cases</p>
<li class="fragment">CTS</li>
</ul>
</section>
</section>
<section>
<h1>Q & A</h1>
</section>
</div>
</div>
<script src="reveal.js/lib/js/head.min.js"></script>
<script src="reveal.js/js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
progress: true,
history: true,
center: true,
slideNumber: true,
overview: false,
theme: Reveal.getQueryHash().theme || 'solarized', // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'none', // default/cube/page/concave/zoom/linear/fade/none
minScale: 0.2,
maxScale: 5.0,
// Parallax scrolling
// parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
// parallaxBackgroundSize: '2100px 900px',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>