Technology-Driven Development:
Using Automation and
Development Techniques
to Grow an Agile Culture
Jul/29/2014
Hiroyuki Ito
Development Process Optimization Department, Rakuten, Inc.
http://www.rakuten.co.jp/
Slide 2
Slide 2 text
2
Hiroyuki Ito
About me
Test-Driven
Development Group
@hageyahhoo
(The Hiro)
4
It’s my 3rd time to be here!
Agile2014 : as a Speaker
Slide 5
Slide 5 text
5
This session’s theme
Technology-
Driven
Development
Slide 6
Slide 6 text
6
Additional possibilities of automation
Slide 7
Slide 7 text
7
“TDD” stands for three purposes
Efficiency
Learning
Collaboration
Slide 8
Slide 8 text
8
By three approaches
CI/CD
TDD
BDD
Slide 9
Slide 9 text
9
Three approaches by
CI/CD
TDD
BDD
Slide 10
Slide 10 text
10
Agenda
1. Conditions and Challenges
3. TDD
2. CI/CD
4. BDD
5. Results, Problems, Possibility and Future
6. Conclusions
Slide 11
Slide 11 text
11
1. Conditions and Challenges
3. TDD
2. CI/CD
4. BDD
5. Results, Problems, Possibility and Future
6. Conclusions
Slide 12
Slide 12 text
12
At the end of April 2013
Business
Analyst
UI/UX
Designers
Developers
Slide 13
Slide 13 text
13
At the end of April 2013
Business
Analyst
Agile Coach
(The Hiro)
UI/UX
Designers
Developers
HELP!
Slide 14
Slide 14 text
14
Our target application is
Slide 15
Slide 15 text
15
Conditions and Challenges
Slide 16
Slide 16 text
16
Conditions and Challenges
None of the team members had
any experience with agile
Slide 17
Slide 17 text
17
Conditions and Challenges
None of the team members had
any experience with agile
There had been
many manual operations
Slide 18
Slide 18 text
18
Conditions and Challenges
None of the team members had
any experience with agile
There had been
many manual operations
Most of the team members
were young and immature
Slide 19
Slide 19 text
19
What do you
think?
Slide 20
Slide 20 text
20
I was so much excited!
Slide 21
Slide 21 text
21
I can
achieve anything
through such a
challenging project!
WHY?
Slide 22
Slide 22 text
22
Three approaches
CI/CD
TDD
BDD
Slide 23
Slide 23 text
23
1. Conditions and Challenges
3. TDD
2. CI/CD
4. BDD
5. Results, Problems, Possibility and Future
6. Conclusions
Slide 24
Slide 24 text
24
Challenges
Low performance
• So many manual tasks
Going in circles
• No clear vision and no requirements
• No timely progress information
Slide 25
Slide 25 text
25
Before CI/CD
• Install applications : 0.5 hour/change
• 5-minite work for 6 persons
• Regression testing : 4 hours/change
• Need to retry if we find bugs…
• Change requests : 3 times/week
13.5 hours/week
Slide 26
Slide 26 text
26
The Implementation of CI/CD in our project
Slide 27
Slide 27 text
27
The Implementation of CI/CD in our project
My PC
Slide 28
Slide 28 text
28
The Implementation of CI/CD in our project
Check-in build (hourly) My PC
Slide 29
Slide 29 text
29
The Implementation of CI/CD in our project
Check-in build (hourly) My PC
Build applications
and run regression tests
automatically
Slide 30
Slide 30 text
30
The Implementation of CI/CD in our project
Check-in build (hourly) My PC
Deliver to
all team members
automatically
Build applications
and run regression tests
automatically
Slide 31
Slide 31 text
31
The Implementation of CI/CD in our project
Check-in build (hourly) My PC
We demonstrate latest application
to the business analyst and managers
in every daily scrum
Deliver to
all team members
automatically
Build applications
and run regression tests
automatically
Slide 32
Slide 32 text
32
Shared understanding by the working software
Business
Analyst
UI/UX
Designers
Developers
Get fast feedback
Know about
the progress
35
1. Conditions and Challenges
3. TDD
2. CI/CD
4. BDD
5. Results, Problems, Possibility and Future
6. Conclusions
Slide 36
Slide 36 text
36
Challenge
Lack of skill and knowledge of Android
• the architecture of Android
• how to develop the Android application
• how to access the database on the
device
• how to implement the UI
Slide 37
Slide 37 text
37
Before TDD
Model
Controller DB
Dao
Activity
DB
Dao
DB
Dao
• Could not test after we implemented all components
(Debug Later Programming)
• It took five days to implement one activity set
Slide 38
Slide 38 text
38
Too difficult to use Android JUnit !
Slide 39
Slide 39 text
39
Too difficult to use Android JUnit !
java.lang.RuntimeException: Stub! (゚Д゚)
Slide 40
Slide 40 text
40
Too difficult to use Android JUnit !
java.lang.RuntimeException: Stub! (゚Д゚)
Why we need an emulator or a device? :-o
Slide 41
Slide 41 text
41
Too difficult to use Android JUnit !
java.lang.RuntimeException: Stub! (゚Д゚)
Why we need an emulator or a device? :-o
Please don’t start a heavy lifecycle of Android
for each test case :-<
Slide 42
Slide 42 text
42
Solution to do TDD on Android
Slide 43
Slide 43 text
43
Solution to do TDD on Android
• Robolectric : Do all unit testing only on JVM
• http://robolectric.org/
• Without any emulator or device!
Slide 44
Slide 44 text
44
Solution to do TDD on Android
• Robolectric : Do all unit testing only on JVM
• http://robolectric.org/
• Without any emulator or device!
• Mockito : Can use the “Test Double”
• http://code.google.com/p/mockito/
Slide 45
Slide 45 text
45
@Before
public void setUp() {
Create database for Test;
Insert test data;
}
@Test
public void findXxx() {
Assertions;
}
@After
public void tearDown() {
Drop Database for Test;
}
Image of Unit testing for Dao by using Robolectric
5 minutes -> 0.5 seconds
to run each test case.
Slide 46
Slide 46 text
46
After TDD
Model
Controller DB
Dao
Activity
DB
Dao
DB
Dao
• Can test each component independently and separately
• It takes one day to implement one activity set
(five times faster than at the start of the project)
Slide 47
Slide 47 text
47
1. Conditions and Challenges
3. TDD
2. CI/CD
4. BDD
5. Results, Problems, Possibility and Future
6. Conclusions
Slide 48
Slide 48 text
48
Challenges
Avoid feature creep
Detect bugs and regressions
on use-cases
Learn domain knowledge effectively
Slide 49
Slide 49 text
49
Example of feature creep
Business
Analyst
UI/UX
Designers
Developers
DONE!
Slide 50
Slide 50 text
50
Example of feature creep
Business
Analyst
UI/UX
Designers
Developers
MORE!
MORE!
MORE!
More features!
DONE!
Slide 51
Slide 51 text
51
Example of feature creep
Business
Analyst
UI/UX
Designers
Developers
MORE!
MORE!
MORE!
More features!
DONE!
NUUN L
Slide 52
Slide 52 text
52
Example of feature creep
Business
Analyst
UI/UX
Designers
Developers
MORE!
MORE!
MORE!
More features!
DONE!
NUUN L
Need discipline!
Slide 53
Slide 53 text
53
Calabash-android: improve the discipline
• The wrapper of Cucumber for Android
• As an executable specification
• As a communication tool
Specifying collaboratively with
business analyst, designers and developers
• By specification with examples
Slide 54
Slide 54 text
54
Example of BDD test scenario with Calabash-Android
Feature: Input
Scenario: Input today’s data
Given I kick drumroll
And drumroll show today
When press next
Then I should see ”xxx" screen
When I press keys and calculator should show like this:
|
2
|
2
|
|
0
|
20
|
|
0
|
200
|
|
*
|
200
|
|
3
|
3
|
|
=
|
600
|
Then take photo
…
• Feature : name of all cases
• Scenario : name of each case
These statements are
RUNNABLE!
We can write data
with table style like this
Slide 55
Slide 55 text
55
We want to…
Process of BDD
Business
Analyst
UI/UX
Designers
Developers
We want to…
Slide 56
Slide 56 text
56
Process of BDD
Business
Analyst
UI/UX
Designers
Developers
GIVEN …
WHEN …
THEN …
Is that right?
MORE!
MORE!
MORE!
We want to…
Slide 57
Slide 57 text
57
Process of BDD
Business
Analyst
UI/UX
Designers
Developers
MORE!
MORE!
MORE!
OK, go ahead!
GIVEN …
WHEN …
THEN …
Is that right?
Slide 58
Slide 58 text
58
Process of BDD
Business
Analyst
UI/UX
Designers
Developers
Is it OK?
GIVEN …
WHEN …
THEN …
Slide 59
Slide 59 text
59
Process of BDD
Business
Analyst
UI/UX
Designers
Developers
MORE!
MORE!
MORE!
Sure!
GIVEN …
WHEN …
THEN …
Is it OK?
66
[Example] Changing scope
Business
Analyst
Agile Coach
(The Hiro)
UI/UX
Designers
Developers
No!
Do all we planned
at first!
Please change scope!
Please change scope!
Please change scope!
Slide 67
Slide 67 text
67
Business
Analyst
Agile Coach
(The Hiro)
UI/UX
Designers
Developers
Belong to
another (subsidiary) company
It’s impossible
to change the scope
within our company…
[Example] Changing scope
Slide 68
Slide 68 text
68
Asked for one executive
YES, YOU CAN!
We changed scope!
Slide 69
Slide 69 text
69
Technical excellence and working software
are not the only way to improve projects.
Point
Anything is OK for improving your situation!
(Anything goes/Vale tudo)
Slide 70
Slide 70 text
70
Possibility and future
Slide 71
Slide 71 text
71
[Example] Growing a collaborative culture
Developers
Got some slack time!
Slide 72
Slide 72 text
72
[Example] Growing a collaborative culture
Developers
Got some slack time!
Too slow
emulator…
Slide 73
Slide 73 text
73
[Example] Growing a collaborative culture
Developers
Got some slack time!
Too slow
emulator…
How about
Genymotion?
Slide 74
Slide 74 text
74
[Example] Growing a collaborative culture
Developers
• Over 10 times faster
• Can run via Calabash-Android
Got some slack time!
Too slow
emulator…
How about
Genymotion?
76
Business
Analyst
Executive
Manager
Agile Coach
(The Hiro)
UI/UX
Designers
Developers
Use “TDD” as a measure for total optimization
Over barriers/silos
Slide 77
Slide 77 text
77
Don’t lose the whole picture!
Slide 78
Slide 78 text
78
1. Conditions and Challenges
3. TDD
2. CI/CD
4. BDD
5. Results, Problems, Possibility and Future
6. Conclusions
Slide 79
Slide 79 text
79
Three purposes
Efficiency
Learning
Collaboration
Slide 80
Slide 80 text
80
Three approaches
CI/CD
TDD
BDD
Slide 81
Slide 81 text
81
Three approaches by
CI/CD
TDD
BDD
Slide 82
Slide 82 text
82
We found this practice
• through the project
• with passionate members
• with a lot of trial and error
Slide 83
Slide 83 text
83
Experience from Gemba
現場主義
Slide 84
Slide 84 text
84
Find your answer
by yourself
through your experience