Content Testing In Eclipse, with ADT Android Testing Framework

Slides:



Advertisements
Similar presentations
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Ashish Mishra Automation Lifecycle of Mobile Applications.
Advertisements

Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Scienze dellInformazione Università di Bologna.
Extending Eclipse Kai-Uwe Mätzel IBM OTI Labs Zurich
JUnit Tutorial Hong Qing Yu Nov JUnit Tutorial The testing problems The framework of JUnit A case study JUnit tool Practices.
J-Unit Framework.
Developing an Eclipse Plug-in David Gallardo. Platform Runtime Workspace Help Team Workbench JFace SWT Eclipse Project Java Development Tools (JDT) Their.
Application Fundamentals Android Development. Announcements Posting in D2L Tutorials.
Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna.
Test Automation Framework Ashesh Jain 2007EE50403 Manager Amit Maheshwari.
T ESTING WITH J UNIT IN E CLIPSE Farzana Rahman. I NTRODUCTION The class that you will want to test is created first so that Eclipse will be able to find.
Unit and Functional Testing with JUnit and Related Tools Greg Barnes University of Washington
All About Android Introduction to Android 1. Creating a New App “These aren’t the droids we’re looking for.” Obi-wan Kenobi 1. Bring up Eclipse. 2. Click.
Model Creation and Testing using Eclipse plug-ins.
The Android Development Environment.  Getting started on the Android Platform  Installing required libraries  Programming Android using the Eclipse.
Android: Hello World Frank Xu Gannon University. Steps Configuration ▫Android SDK ▫Android Development Tools (ADT)  Eclipse plug-in ▫Android SDK and.
Android Tutorial Android Written in Java Utilizes Dalvik VM – Just in time (JIT) compilation since Android 2.2.
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
Setting up the Development Environment Copyright © SUPINFO. All rights reserved Preparation.
Robotium Tran Dai T1309L. Introduce What is Robotium ? How can setup ? Why we need Robotium ? When.
Android Application Development 2013 PClassic Chris Murphy 1.
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Table-Driven Acceptance Testing Mario Aquino Principal Software Engineer Object Computing, Inc.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Duke University Program Design & Construction Course Application Development Tools Sherry Shavor
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
Android Info mostly based on Pro Android 3.  User Applications  Java Libraries – most of Java standard edition ◦ Activities/Services ◦ UI/Graphics/View.
Testing with Android Part I of II. Android Testing Framework Based on JUnit The Android JUnit extensions provide component-specific test case classes.
Intro to Android Development Ben Lafreniere. Getting up and running Don’t use the VM! ials/hello-world.html.
Ali Shahrokni Application Components Activities Services Content providers Broadcast receivers.
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Capture and Replay Often used for regression test development –Tool used to capture interactions with the system under test. –Inputs must be captured;
Mobile Application Development using Android Lecture 2.
DUE Hello World on the Android Platform.
Android for Java Developers Denver Java Users Group Jan 11, Mike
Eclipse Tutorial Barrett Summer Scholars 2011 Sustainable Engineering: Learning to Engineer Truly Green Products.
Presented By: Muhammad Tariq Software Engineer Android Training course.
ANDROID – TESTING L. Grewe. With the AndroidStudio IDE.
CSC 216/001 Lecture 4. Unit Testing  Why is it called “unit” testing?  When should tests be written?  Before the code for a class is written.  After.
JUnit & Eclipse1 DEPARTMENT OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING CONCORDIA UNIVERSITY Feb 2, 2009 revision 1.2 – Feb 2, 2009 by Emil Vassev & Joey.
Oracle Data Integrator Procedures, Advanced Workflows.
Android architecture & setting up. Android operating system comprises of different software components arranges in stack. Different components of android.
JUnit test and Project 3 simulation. 2 JUnit The testing problems The framework of JUnit A case study Acknowledgement: using some materials from JUNIT.
Android Development Environment Environment/tools Windows Eclipse IDE for Java Developers (v3.5 Galileo) Java Platform (JDK 6 Update 18) Android.
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
 Installation of Android Development Environment  Creating the App with OpenGL ES API  Running the App on Emulator Android App Development.
JUnit Don Braffitt Updated: 10-Jun-2011.
JUnit Eclipse, Java and introduction to Junit. Topics Covered  Using Eclipse IDE  Example Java Programs  Junit Introduction.
Testing in Android. Methods Unit Testing Integration Testing System Testing Regression Testing Compatibility Testing Black Box (Functional) White Box.
JUnit A Unit Testing Framework for Java. The Objective Introduce JUnit as a tool for Unit Testing Provide information on how to: Install it Build a test.
ANDROID APPLICATION DEVELOPMENT. ANDROID DEVELOPMENT DEVELOPER.ANDROID.COM/INDEX.HTML THE OFFICIAL SITE FOR ANDROID DEVELOPERS. PROVIDES THE ANDROID SDK.
All the dSoftArk Tools Getting started!. Tools dSoftArk is a semi-realistic, agile, development project –Industrial strength software (programming, TDD,
Test a Little, Code a Little Colin Sharples IBM Global Services New Zealand Colin Sharples IBM Global Services New Zealand.
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
Topic: Junit Presenters: Govindaramanujam, Sama & Jansen, Erwin.
Guide To Develop Mobile Apps With Titanium. Agenda Overview Installation of Platform SDKs Pros of Appcelerator Titanium Cons of Appcelerator Titanium.
Is it really possible to test my app? By Paweł Suszek
Why Learn Android? Largest installation base of any operating system Over 20,000 Android devices exist Businesses will likely move more to device-based.
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
Unit Testing.
Don Braffitt Updated: 26-Mar-2013
Android – tESTING L. Grewe.
CS 240 – Advanced Programming Concepts
The Most Popular Android UI Automation Testing Tool Andrii Voitenko
Android Application Development
Mobile Programming Dr. Mohsin Ali Memon.
JUnit Tutorial Hong Qing Yu Nov 2005.
Presentation transcript:

Content Testing In Eclipse, with ADT Android Testing Framework 1. Overview 2. The Testing API 3. Working in the Test Environment

Testing In Eclipse, with ADT Target: an HelloAndroid application It runs like this: Testing abjective: To test if textview shows the right string as defined in string resource

Testing In Eclipse, with ADT Creating the Test Project 1. In Eclipse, select New > Project > Android > Android Test Project>next

Testing In Eclipse, with ADT

Creating the Test Case Class

android.test.ActivityInstrumentationTestCase2

Testing In Eclipse, with ADT Import com.zy.helloandroid.HelloAndroid; public HelloAndroidTest() { super("com.zy.helloandroid", HelloAndroid.class); }

Android Testing Framework. roid.html roid.html 1. Overview 2. The Testing API 3. Working in the Test Environment

overview: extensions to the JUnit framework An instrumentation framework Mock versions of commonly-used Android system objects. Tools for running single tests or test suites, with or without instrumentation. Support for managing tests and test projects in the ADT Plugin for Eclipse and at the command line.

overview: Your test application is linked to the application under test by means of an element in the test application's manifest file

The Testing API extend the JUnit TestCaseTestCase package android.test.android.test 1. JUnit test case classes extend the JUnit TestCase but do not use the instrumentation framework.TestCase contain methods for accessing system objects like Context The base class is AndroidTestCase, but you usually use a subclass associated with a particular component.AndroidTestCase ApplicationTestCase - A class for testing an entire application ApplicationTestCase ProviderTestCase2 - A class for isolated testing of a single ContentProvider. ProviderTestCase2 ContentProvider ServiceTestCase - a class for isolated testing of a single Service. ServiceTestCase Service

The Testing API 2. Instrumentation test case classes uses the instrumentation framework. With instrumentation: automate UI precisely control the start of an activity monitor the state of the activity during its life cycle. The base class is InstrumentationTestCase.InstrumentationTestCase The subclasses are: ActivityTestCase - A base class for activity test classes. ActivityTestCase SingleLaunchActivityTestCase - A convenience class for testing a single activity SingleLaunchActivityTestCase SyncBaseInstrumentation - A class that tests synchronization of a content provider. SyncBaseInstrumentation ActivityUnitTestCase - This class does an isolated test of a single activity. ActivityUnitTestCase ActivityInstrumentationTestCase2 - This class tests a single activity within the normal system environment. ActivityInstrumentationTestCase2

The Testing API 3. Assert classes extends the JUnit AssertAssert two extensions : MoreAsserts :contains more powerful assertions MoreAsserts such as assertContainsRegex(String, String)assertContainsRegex(String, String) ViewAsserts :contains useful assertions about Android Views. ViewAsserts such as assertHasScreenCoordinates(View, View, int, int)assertHasScreenCoordinates(View, View, int, int)

The Testing API 4. Mock object classes creating mock system objects such as applications, contexts… found in android.test and android.test.mock. They are:android.testandroid.test.mock IsolatedContext - Mocks a Context so that the application using it runs in isolation. This class is useful in unit testing. IsolatedContext RenamingDelegatingContext - Delegates most context functions to an existing, normal context while changing the default file and database names in the context. Use this to test file and database operations with a normal system context, using test names. RenamingDelegatingContext MockApplication, MockContentResolver, MockContext, MockDialogInterface, MockPackageManager, MockResources - Classes that create mock Android system objects for use in testing. They expose only those methods that are useful in managing the object. MockApplicationMockContentResolverMockContext MockDialogInterfaceMockPackageManager MockResources

The Testing API 5. InstrumentationTestRunner a custom class for running tests. controls of the application under test, runs the test application and the main application in the same process. control the entire test environment at runtime.

Working in the Test Environment 1. Working with test projects Use Android tools to create a test project for your project under test. The tools create the project directory and the files and subdirectories needed. The tools also create a manifest file that links the application in the test project to the application under test

Working in the Test Environment 2. Working with test case classes A test application contains one or more test case classes that extend an Android test case class. choose a test case class based on the type of Android component you are testing and the tests you are doing. A test application can test different components, but each test case class is designed to test a single type of component. Some Android components have more than one associated test case class.

Working in the Test Environment 3. Working with test methods Each test case class provides methods that you use to set up the test environment and control the application under test. you add methods to the class to define individual tests. Each method you add is run once each time you run the test application. special methods: setUp() : setUp() invoked before any of the test methods in the class. Use it to set up the environment for the test. call super.setUp() as the first statement in your code. runs before each of your methods. tearDown(): invoked after all the test methods in the class. Use it to do garbage collection and re-setting before moving on to the next set of tests. you must call super.tearDown() as the last statement in your code. run once after each of your methods.

Working in the Test Environment 4. Running tests and seeing the results ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ the output appears in a new JUnit view pane.

Working in the Test Environment 5. What to Test Activity lifecycle events: You should test that your activities handle lifecycle events correctly. Database operations: You should ensure that database operations correctly handle changes to the application's state. Screen sizes and resolutions: make sure to test it on all of the screen sizes and densities on which you want it to run When possible, you should run these tests on an actual device.

Thank you!!!