Learning Android Application Testing
eBook - ePub

Learning Android Application Testing

Paul Blundell, Diego Torres Milano

Partager le livre
  1. 274 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Learning Android Application Testing

Paul Blundell, Diego Torres Milano

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Learning Android Application Testing est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Learning Android Application Testing par Paul Blundell, Diego Torres Milano en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatique et Programmation d'appareils mobiles. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2015
ISBN
9781784395339

Learning Android Application Testing


Table of Contents

Learning Android Application Testing
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
Questions
1. Getting Started with Testing
Why, what, how, and when to test?
What to test
Activity lifecycle events
Database and filesystem operations
Physical characteristics of the device
Types of tests
Unit tests
The setUp() method
The tearDown() method
Outside the test method
Inside the test method
Mock objects
Integration tests
UI tests
Functional or acceptance tests
Test case scenario
Performance tests
System tests
Android Studio and other IDE support
Java testing framework
Android testing framework
Instrumentation
Gradle
Test targets
Creating the Android project
Package explorer
Creating a test case
Test annotations
Running the tests
Running all tests from Android Studio
Running a single test case from your IDE
Running from the emulator
Running tests from the command line
Running all tests
Running tests from a specific test case
Running a specific test by name
Running specific tests by category
Running tests using Gradle
Creating a custom annotation
Running performance tests
Dry run
Debugging tests
Other command-line options
Summary
2. Understanding Testing with the Android SDK
The demonstration application
Assertions in depth
Custom messages
Static imports
View assertions
Even more assertions
The TouchUtils class
Mock objects
An overview of MockContext
The IsolatedContext class
Alternate route to file and database operations
The MockContentResolver class
The TestCase base class
The default constructor
The given name constructor
The setName() method
The AndroidTestCase base class
The assertActivityRequiresPermission() method
Description
Example
The assertReadingContentUriRequiresPermission method
Description
Example
The assertWritingContentUriRequiresPermission() method
Description
Example
Instrumentation
The ActivityMonitor inner class
Example
The InstrumentationTestCase class
The launchActivity and launchActivityWithIntent methods
The sendKeys and sendRepeatedKeys methods
The runTestOnUiThread helper method
The ActivityTestCase class
The scrubClass method
The ActivityInstrumentationTestCase2 class
The constructor
The setUp method
The tearDown method
The ProviderTestCase2<T> class
The constructor
An example
The ServiceTestCase<T>
The constructor
The TestSuiteBuilder.FailedToCreateTests class
Using libraries in test projects
Summary
3. Baking with Testing Recipes
Android unit tests
Testing activities and applications
Mocking applications and preferences
The RenamingMockContext class
Mocking contexts
Testing activities
Testing files, databases, and content providers
The BrowserProvider tests
Testing exceptions
Testing local and remote services
Extensive use of mock objects
Importing libraries
Mockito usage example
The EditNumber filter tests
Testing views in isolation
Testing parsers
Android assets
The parser test
Testing for memory usage
Testing with Espresso
Summary
4. Managing Your Android Testing Environment
Creating Android Virtual Devices
Running AVDs from the command line
Headless emulator
Disabling the keyguard
Cleaning up
Terminating the emulator
Additional emulator configurations
Simulating network conditions
Speeding up your AVD with HAXM
Alternatives to the AVD
Running monkey
The client-server monkey
Test scripting with monkeyrunner
Getting test screenshots
Record and playback
Summary
5. Discovering Continuous Integration
Building Android applications manually using Gradle
Git – the fast version control system
Creating a local Git repository
Continuous integration with Jenkins
Installing and configuring Jenkins
Creating the jobs
Obtaining Android test results
Summary
6. Practicing Test-driven Development
Getting started with TDD
Writing a test case
Running all tests
Refactoring the code
Advantages of TDD
Understanding the requirements
Creating a sample project – the temperature converter
List of requirements
User interface concept design
Creating the project
Creating a Java module
Creating the TemperatureConverterActivityTests class
Creating the fixture
Creating the user interface
Testing the existence of the user interface components
Getting the IDs defined
Translating requirements to tests
Empty fields
View properties
Screen layout
Adding functionality
Temperature conversion
The EditNumber class
The TemperatureConverter unit tests
The EditNumber tests
The TemperatureChangeWatcher class
More TemperatureConverter tests
The InputFilter tests
Viewing our final application
Summary
7. Behavior-driven Development
Given, When, and Then
FitNesse
Running FitNesse from the command line
Creating a TemperatureConverterTests subwiki
Adding child pages to the subwiki
Adding the acceptance test fixture
Adding the supporting test classes
GivWenZen
Creating the test scenario
Summary
8. Testing and Profiling Performance
Ye Olde Logge method
Timing logger
Performance tests in Android SDK
Launching the performance test
Creating the LaunchPerformanceBase instrumentation
Creating the TemperatureConverterActivityLaunchPerformance class
Running the tests
Using the Traceview and dmtracedump platform tools
Dmtracedump
Microbenchmarks
Caliper microbenchmarks
Benchmarking the temperature converter
Running Caliper
Summary
9. Alternative Testing Tactics
Code coverage
Jacoco features
Temperature converter code coverage
Generating code coverage analysis report
Covering the exceptions
Introducing Robotium
Adding Robotium
Creating the test cases
The testFahrenheitToCelsiusConversion() test
Testing between Activities
Testing on the host's JVM
Comparing the performance gain
Adding Android to the picture
Introducing Robolectric
Installing Robolectric
Adding resources
Writing some tests
Google's march on shadows
Introducing Fest
Introducing Spoon
Introducing Fork
Summary
Index
...

Table des matiĂšres