Upload
hasan-hosgel
View
3.230
Download
0
Embed Size (px)
Citation preview
www.immobilienscout24.de
www.immobilienscout24.de
Android Meetup Berlin | 30.05.2012 | Hasan Hosgel
Coexisting of Android and Robots Introduction to RoboGuice & Robotium
www.immobilienscout24.de
About me
Hasan Hoşgel Twitter: @alosdev Github: alosdev G+: Hasan Hosgel
Senior Developer
Mobile enthusiast, Man of action
| Coexisting of Android and Robots | Hasan Hosgel
Seite 3
ImmobilienScout24 Germany‘s leading real-estate portal
550 employees, 160 in the IT
| Coexisting of Android and Robots | Hasan Hosgel
Seite 4
ImmobilienScout24 Germany‘s leading real-estate portal
550 employees, 160 in the IT > 7.5 Million unique users
> 2 Billion PI > 260 Million Expose views ~ 1.5 Million active listings > 110,000 Vendors ... per month > 3 Mio App-Downloads
| Coexisting of Android and Robots | Hasan Hosgel
Seite 5
ImmobilienScout24 Germany‘s leading real-estate portal
550 employees, 160 in the IT
2 datacenter ~100 physical ~800 virtual ... machines
> 7.5 Million unique users > 2 Billion PI > 260 Million Expose views ~ 1.5 Million active listings > 110,000 Vendors ... per month > 3 Mio App-Downloads
Normal activity
Seite 6 | Coexisting of Android and Robots | Hasan Hosgel
Normal activity
Seite 7 | Coexisting of Android and Robots | Hasan Hosgel
do you like it?
Normal activity
Seite 8 | Coexisting of Android and Robots | Hasan Hosgel
do you like it?
a lot of boilerplate code
How to avoid this?
Seite 9 | Coexisting of Android and Robots | Hasan Hosgel
How to avoid this?
Seite 10 | Coexisting of Android and Robots | Hasan Hosgel
as the talk subject says RoboGuice
RoboGuice
Seite 11 | Coexisting of Android and Robots | Hasan Hosgel
DI & IOC Framework for Android
Source: http://roboguice.org
RoboGuice
Seite 12 | Coexisting of Android and Robots | Hasan Hosgel
DI & IOC Framework for Android
based on Google Guice no AOP (JSR-330 compatible)
Source: http://roboguice.org
RoboGuice
Seite 13 | Coexisting of Android and Robots | Hasan Hosgel
DI & IOC Framework for Android
based on Google Guice no AOP (JSR-330 compatible)
actual version 2.0
Source: http://roboguice.org
definition IOC & DI source: http://wikipedia.com
Seite 14 | Coexisting of Android and Robots | Hasan Hosgel
Dependency injection is a software design pattern that allows a choice of component to be made at run-time rather than compile time. This can be used, for example, as a simple way to load plugins dynamically or to choose mock objects in test environments vs. real objects in production environments.
In software engineering, Inversion of Control (IoC) is an object-oriented programming practice whereby the object coupling is bound at run time by an "assembler" object and is typically not knowable at compile time using static analysis.
definition IOC & DI source: http://wikipedia.com
Seite 15 | Coexisting of Android and Robots | Hasan Hosgel
Dependency injection is a software design pattern that allows a choice of component to be made at run-time rather than compile time. This can be used, for example, as a simple way to load plugins dynamically or to choose mock objects in test environments vs. real objects in production environments.
In software engineering, Inversion of Control (IoC) is an object-oriented programming practice whereby the object coupling is bound at run time by an "assembler" object and is typically not knowable at compile time using static analysis.
Spring Google Guice
EJB (> 3.0) JBoss Seam
What you need for RoboGuice?
Seite 16 | Coexisting of Android and Robots | Hasan Hosgel
Android project
RoboGuice 2.0
Guice 3.0 no AOP
javax.inject
Configuration
Seite 17 | Coexisting of Android and Robots | Hasan Hosgel
extend Robo* classes
Configuration
Seite 18 | Coexisting of Android and Robots | Hasan Hosgel
extend Robo* classes
create roboguice_modules.xml
Configuration
Seite 19 | Coexisting of Android and Robots | Hasan Hosgel
extend Robo* classes
create roboguice_modules.xml
create your AbstractModule
Configuration
Seite 20 | Coexisting of Android and Robots | Hasan Hosgel
extend Robo* classes
create roboguice_modules.xml
create your AbstractModule
configure the module in the xml
Injection Types
Seite 21 | Coexisting of Android and Robots | Hasan Hosgel
Injection Types
Seite 22 | Coexisting of Android and Robots | Hasan Hosgel
member injection
Injection Types
Seite 23 | Coexisting of Android and Robots | Hasan Hosgel
member injection
setter injection
injection types
Seite 24 | Coexisting of Android and Robots | Hasan Hosgel
member injection
setter injection
constructor injection
annotation types part 1
Seite 25 | Coexisting of Android and Robots | Hasan Hosgel
! @Inject
! standard Guice annotation
! @InjectView(resId)
! inject views after „setContentView()“ in „onCreate()“
! @InjectResource(resId)
! inject resource in „onCreate()“
! @InjectExtra(extraName)
! inject extra only in „onCreate()“ NOT „onNewIntent()“
! @InjectPreference(keyName)
! reads preference by keyName
! @InjectFragment(resId, tagName)
! inject the fragment to the resId with the tagName
annotation types part 2
Seite 26 | Coexisting of Android and Robots | Hasan Hosgel
! @ContentView(resId)
! set layout for activity/ fragment
! @Named(valueName)
! with the valueName a specific configuration can be done
! no annotation but related Provider<T>
! asynchronous injection, if the creation is expensive and not always used. The method #get() can be used
RoboGuiced activity
Seite 27 | Coexisting of Android and Robots | Hasan Hosgel
Normal activity
Seite 28 | Coexisting of Android and Robots | Hasan Hosgel
for comparison
RoboGuiced activity
Seite 29 | Coexisting of Android and Robots | Hasan Hosgel
much better & clearer
RoboGuice in Action
Seite 30 | Coexisting of Android and Robots | Hasan Hosgel
RoboGuice in Action
Seite 31 | Coexisting of Android and Robots | Hasan Hosgel
Live Coding...
Robotium
Seite 32 | Coexisting of Android and Robots | Hasan Hosgel
Test Framework for Android
similar to Selenium/ WebTest
actual version 3.2.1
What you need for Robotium?
Seite 33 | Coexisting of Android and Robots | Hasan Hosgel
robotium-solo-3.2.1
extend from ActivityInstrumentationTestCase2
instanciate Solo
finishInactiveActivities & finishOpenedActivities on solo in teardown
What you can do with Robotium?
Seite 34 | Coexisting of Android and Robots | Hasan Hosgel
! remote run of application/ black box tests
! click on view
! long click on view
! scroll
! search for text and view
! wait for text and view
! enter text
! send keys
! configure sleeper/ waiter? NO è use fork https://github.com/alosdev/robotium
Robotium in Action
Seite 35 | Coexisting of Android and Robots | Hasan Hosgel
Robotium in Action
Seite 36 | Coexisting of Android and Robots | Hasan Hosgel
Live Coding...
! clearer structure/ better API
! better testable/ test automation
! state of the art è proven in production (@IS24 since more than 1 year)
! good for libraries
Why this fuss?
| Coexisting of Android and Robots | Hasan Hosgel Seite 37
use RoboGuice & Robotium for Android
Dive into the topic & sources
Seite 38 | Coexisting of Android and Robots | Hasan Hosgel
! github with sample project of presentation:
! https://github.com/alosdev/amu-roboguice
! slideshare:
! http://www.slideshare.net/hosgel/coexisting-of-android-robots
! RoboGuice:
! http://roboguice.org/
! Robotium:
! http://robotium.org/
! deeper look into RoboGuice:
! http://www.blog.project13.pl/wp-content/uploads/2011/12/presentation.html
Thanks for your attention! Questions?
http://www.flickr.com/photos/peterjlambert/97671748/sizes/o/in/photostream/
www.immobilienscout24.de
Kontakt: ImmobilienScout24 Andreasstraße 10 10243 Berlin
Vielen Dank für Ihre Aufmerksamkeit!
Fon: 030/24301-11 00 Email: [email protected]. URL: www.immobilienscout24.de