You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-13Lines changed: 35 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,51 @@
1
1
# AndroidTestingTutorial
2
2
Getting started with Espresso Unit Testing
3
3
4
-
# Why Testing?
4
+
Why Testing?
5
+
-------------------------------
5
6
testing is the process of evaluation a software item to detect differences between given input and expected output.
7
+
<br/>
6
8
7
-
# Categories of Testing
9
+
Categories of Testing
10
+
-------------------------------
8
11
1. Black box testing
9
12
2. White box testing<br>
10
13
etc... others can be found <ahref="http://www.softwaretestinghelp.com/types-of-software-testing/">here</a>
14
+
<br/>
11
15
12
-
# Black box testing
16
+
Black box testing
17
+
-------------------------------
13
18
Tests are based on requirements and functionality.
19
+
<br/>
14
20
15
-
# White box testing
21
+
White box testing
22
+
-------------------------------
16
23
Tests are based on coverage of code statements, branches, paths, conditions.
17
24
18
-
# TDD
25
+
26
+
27
+
TDD
28
+
-------------------------------
19
29
Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only.
30
+
<br/>
20
31
21
-
# Android Testing Tools
32
+
Android Testing Tools
33
+
-------------------------------
22
34
1. <ahref="https://developer.android.com/training/testing/ui-testing/espresso-testing.html">Espresso by google team</a>
Mainly focused on UI and Thread idealization, which helps the unit tests to run without worring about api response state
30
43
It checks the threads and waits for ui thread to be idealize which is dismiss progress bar or any event which shows that activity is performing some event.
44
+
<br/>
31
45
32
-
# Why Espresso
46
+
47
+
Why Espresso
48
+
-------------------------------
33
49
Other tools like Roboletric is also famous for testing android apps but it has it's own android jar which is our basic android kit classes.
34
50
As google updates their support library often it's hard to keep in update for Roboletric.
35
51
And to mock the android classes becomes hard with Roboletric.
@@ -86,7 +102,9 @@ public class PerfomClickAndCheckTextError {
86
102
87
103
Like above I had taken resources.
88
104
89
-
# Tutorial 1
105
+
Tutorial 1
106
+
-------------------------------
107
+
90
108
We have started programming with hello world! program and for testing we will do the same. Simple step check the text is on the screen.
91
109
but before that let's check how to <kbd>find view</kbd> from the screen in Espresso
92
110
@@ -120,7 +138,8 @@ above code checked that screen has some textview having text Hello Floks!
120
138
<br/>
121
139
<br/>
122
140
123
-
# Tutorial 2
141
+
Tutorial 2
142
+
-------------------------------
124
143
Now that we have successed in finding view and performing checks we will move to step 2 which is perform events like typing and clicking.
open activity with data in bundle as it's important to pass data with activity
143
164
144
165
you want to check activity with custom data
@@ -177,7 +198,8 @@ public class PassDataInActivityTest {
177
198
````
178
199
179
200
180
-
# Tutorial 5
201
+
Tutorial 5
202
+
-------------------------------
181
203
Responding to external intents like gallery picks
182
204
It's hard to control external apps as with device applications can have different views so it's not steady like your UI. in this condition what you can do is develop dependency injected code where you can mock the intents results or you can give result of intents in testing.
0 commit comments