Archive for August, 2012

Steps to install MonkeyTalk Android Agent:

1. Open your android project in eclipse.

2. Convert your android project in AspectJ .

*For this step you have to configure AJDT in Eclipse by following steps:

Open Eclipse >>Go to help  menu >> Install New Software >> Click on Add

Then fill the fields in ‘Add Repository’ window

Name: AJDT

Location: http://download.eclipse.org/tools/ajdt/37/update

Click on ok. *

3. Create a folder in your android project named as “libs”,  if you don’t already have one.

4. Copy the MonkeyTalk-agent.jar file in libs folder.

* MonkeyTalk-agent.jar can be found in the “agents” folder in the MonkeyTalk package you downloaded earlier. The exact name of the jar might vary depending on the version, but it should always start with “MonkeyTalk-agent”.

5. Now add this MonkeyTalk jar file to aspect path:

Right click on MonkeyTalk-agent.jar

Go to  AspectJ Tools

Click on  Add to Aspectpath

6. Update your AndroidManifest.xml to include the following two permissions:

  • android.permission.INTERNET
  • android.permission.GET_TASKS

<uses-permission android:name=”android.permission.GET_TASKS” />

<uses-permission android:name=”android.permission.INTERNET” />

*You can find Androidmanifest.xml file under res folder of your android project.*

7. Update the project properties (right-click on the project > Properties > Java Build Path), select the Order and Export tab, and check the checkbox next to the AspectJ Runtime Library to export it.

8. Deploy your application to an Android device or emulator.

Right click on Android project

Choose “Run as” option and then “Android Application”

STLC (Software Test Life Cycle):

Software testing life cycle (STLC) identifies what test activities to carry out i.e. the process of testing software in a well planned and systematic way is known as software testing lifecycle (STLC).STLC consists of six different phases.

1.Requirements Analysis:

In this phase testers analyze the customer requirements and work with developers during the design phase to see which requirements are testable.

2.Test Planning:

In this phase all the planning about testing is done like what needs to be tested, how the testing will be done, test strategy to be followed, what will be the test environment, what test methodologies will be followed, hardware and software availability, resources, risks etc. During the planning stage, the team of senior level persons comes out with an outline of Testing Plan at High Level. Test plan describe the following:

o   Scope of testing

o   Identification of resources

o   Identification of test strategies

o   Identification of Risks

o   Time schedule

3. Test Case Development:

In this phase test cases are created by tester for testing. In case of automation testing test scripts are created by the tester. This phase also involves the following activities:

o   Revision & finalization of Matrix for Functional Validation.

o   Revision & finalization of testing environment.

o   Review and baseline test cases and scripts

4.     Test Environment setup:

This phase involves the following activities:

  • Understand the required architecture, environment set-up.
  • Prepare hardware and software requirement list
  • Finalize connectivity requirements
  • Setup test Environment and test data
  • Prepare environment setup checklist

5.   Test Execution and Bug Reporting:

In this phase test cases are executed and defects are reported in bug tracking tool, after the test execution is complete and all the defects are reported. After developers fixes the bugs which are reported by the tester, tester conduct the regression testing to ensure that bug has been fixed and not affected any other areas of software

6. Test Cycle closure:

This phase involves the following activities:

  • Track the defects to closure
  • Evaluate cycle completion criteria based on – Time, Test coverage , Cost , Software Quality , Critical  Business ObjectivesPrepare test metrics based on the above parameters.
  •  Prepare Test closure report
  • Test result analysis to find out the defect distribution by type and severity

MonkeyTalk:

Monkey Talk is a functional testing tool for mobile applications. It supports android and iOS platforms. It supports iOS 4.0 or greater and Android 2.2 or greater.

Monkey Talk has three components which are as follows:

  • MonkeyTalk IDE – It is used  for record/playback of test scripts
  • MonkeyTalk Agent – It is a library that must be added to enable the testing. There are different agents for different platform i.e. for android and iOS. The agents enable applications to record and play MonkeyTalk Commands.
  • MonkeyTalk scripts – Scripts contains the all the actions. With the help of scripts we can test the overall functionality of an app. MonkeyTalk scripts can be written in three forms that are,
  • o   In JavaScript form
  • o   In tabular form (i.e. in different cells)
  • o   In MonkeyTalk form (In single line format, one line considered as a one command)

Features and benefits:

  • It is open source tool i.e. it is free to download and free to use.
  • It is a powerful complete functional testing tool.
  • Same script can be used on both android and iOS of an app i.e. record on iOS and playback on Android and vice versa.
  • MonkeyTalk is simple and easy to learn.
  • MonkeyTalk scripts can be understood by average person.
  • No expertise required in programming.
  • Both phones and tablets are supported, either tethered or over the network.
  • MonkeyTalk scripts can be easily extended, even by non-programmers, with custom user-defined commands. (Keyword-driven scripts)
  • It supports looping concept. Any command can be looped using csv file. (Data-driven scripts)
  • Both Html and xml reports can be generated with this tool. Generally, test suites output the standard XML report and it captures the screenshot when failure occurs.

Installing MonkeyTalk:

Download MonkeyTalk Zip file from” http://www.gorillalogic.com/testing-tools/monkeytalk/download” and simply unzip the file on your Pc.

 

 

 

 

 

 

Test Metrics

Posted: August 30, 2012 in Testing Basics
Tags: , , ,

Test Metrics:

The objective of Test Metrics is to capture the planned and actual quantities the effort, time and resources required to complete all the phases of Testing of the SW Project. It provides a measure of the percentage of the software tested at any point during testing.
Test metrics should cover basically 3 things:
1. Test coverage
2. Time for one test cycle
3. Convergence of testing

There are various types of test metrics. Different organization used different types of test metrics.

Functional test coverage:It can be calculated as:
FC=Number of test requirements that are covered by test cases/Total number of test requirements.

Schedule Variance:Schedule Variance indicates how much ahead or behind schedule the testing is. It can be calculated as:
SV = (Actual End Date-Planned End Date) / (Planned End Date-Planned Start Date+1)*100

A high value in schedule variance may signify poor estimation. A low value in schedule variance may signify correct estimation, clear and well understood requirements.

Effort Variance: Effort may be measured in person hours or person days or person months. Effort variance would be computed for all tasks completed during a period .It can be calculated as:
EV= (Actual effort-Estimated effort)/ (Estimated Effort) X 100%

A high positive value of effort variance may signify optimistic estimation, changing business processes, high learning curve, new technology and/or functional area.
A high negative value of effort variance may signify pessimistic estimation or excessive buffering an efficient and skilful project team, high level of componentization and re-usability, clear plans and schedules.
A low value of effort variance may signify accuracy in estimation, timely availability of resources, no creeping requirements.

Defect Age (In Time): Defect Age is used to calculate the time from Introduction to Detection.
Average Age = Phase (Detected – Introduced) / Number of Defects

On-Time delivery: This metrics sheds light on the ability to meet customer commitments. On time delivery may be tracked during the course of the project based on the actual delivery dates and planned commitments for the deliveries done during a period.
OTD= ((No. Of Delivery on time)/Total No of due Delivery)*100

A low value of %On time delivery may signify poor planning and tracking, delays on account of customer, , incorrect estimation, or may point to a project risk having occurred.
A large value of %on time delivery may signify good planning, tracking and foresight, with a high responsiveness for immediate corrective action; a receptive customer, high commitment of the team, and good estimation.

Test cost: It is used to find resources consumed in the testing.
TC= test cost Vs total system cost
This meets identifies the amount of resources used in testing process.

ADB(Android Debug Bridge)

Posted: August 30, 2012 in Android
Tags: ,

Android Debug Bridge:
Android Debug Bridge (adb) is a command line tool that lets you communicate with an emulator or connected Android device. It is a client-server program that includes three components:

  • Client- It runs on your development machine. You can invoke a client from a shell by issuing an adb command.
  • Server-It runs as a background process on your development machine. The server manages communication between the client and the adb daemon.
  • Daemon- It runs as a background process on each emulator or device instance.

ADB is found as part of the Andriod SDk Platform-tools package, it consists of both client and server-side programs that communicate with one another.

When you start an adb client, first checks whether there is an adb server process already running. If there is no adb running process, it starts the server process. When server starts, it binds to local TCP port and listens the adb commands. The server then sets up connections to all running emulator/device instances. It locates emulator/device instances by scanning odd-numbered ports in the range 5555 to 5585, the range used by emulators/devices. Where the server finds an adb daemon, it sets up a connection to that port.

ADB Commands:
The format for issuing commands through the ADB is as follows:
adb [-d|-e|-s <serialNumber>] <command>

Installing an Application:
With the help of adb we can install our app on emulator or device.
adb install <path_to_apk>
where <path_to_apk> is the path of that apk file which you want to install on emulator/device.

Viewing connected Android devices:
To view the attached devices use devices command. It prints a list of all attached emulator/device instances.
adb devices
Here’s an example showing the devices command and its output:
$ adb devices
List of devices attached
emulator-5554 device
emulator-5556 device
emulator-5558 device
where emulator-5558 is the serial number and device is the instance that is connected to adb server.

If there is no emulator/device running, adb returns no device.

Sending commands to specific emulator/device:
If multiple emulator/device instances are running, you need to specify a target instance when issuing adb commands.
adb -s <serialNumber> <command>
Example: adb -s emulator-5556 install demo1.apk

Copying Files to or from an Emulator/Device :

You can use the adb commands pull and push to copy files to and from an emulator/device.

If you want to copy a file from the emulator or device you can use pull command.
adb pull <remote> <local>

If you want to copy a file to  the emulator or device you can use push command.
adb push <local> <remote>

In the commands, <local> and <remote> refer to the paths to the target files/directory on your development machine (local) and on the emulator/device instance (remote).

Starting and killing the server:

To start server use,
adb start-server
When the server starts, it binds to local TCP port 5037. All adb clients use port 5037 to communicate with the adb server.

To kill server use kill-server command it kills the already running server.
adb kill-server

Forwarding Ports:
Forward command is used to forward the requests on the specific host port to a different port on emulator/device instance.
adb forward tcp:6100 tcp:7100

Enabling logcat Logging
You can use the logcat command to view log output in your development computer.
adb logcat

Android Application Fundamentals:

Android applications are written in the Java programming language. The Android SDK tools compile the code—along with any data and resource files. All Code resides in a single file that is apk file (android package file).apk file is use to install the app on device .

Each Android application lives in its own world.

The Android operating system is a multi-user Linux system in which each application is a different user.

By default, every application runs in its own Linux process. Android starts the process when any of the application’s code needs to be executed, and shuts down the process when it’s no longer needed and system resources are required by other applications.

Each process has its own Java virtual machine (VM), so application code runs in isolation from the code of all other applications.

By default, each application is assigned a unique Linux user ID. Permissions are set so that the application’s files are visible only that user, only to the application itself — although there are ways to export them to other applications as well.

Different applications can share data with each other but there are some conditions:

  • Both applications has same linux user id and they must be run under same linux process.
  • The applications must also be signed with the same certificate.

Application Components:

There are various components of android application which are essential building blocks of applications which are exists as its own entities and plays a specific role. Building blocks of application define the overall behavior of your app. There are four types of components of an application

1) Activities: An activity provides a user interface for a single screen in your application. Activities can move into the background and then be resumed with their state restored. An application usually consists of multiple activities that are loosely bound to each other. Typically, one activity in an application is specified as the “main” activity, which is presented to the user when launching the application for the first time. If an application is composed of several screens, it has an activity for each screen. when new activity starts a new activity starts, the previous activity is stopped, but the system preserves the activity in a stack.

2) Services: A service is an Android application component that runs in background and has no visual UI. Services are used to perform the processing parts of your application in the background. While the user is working on the foreground UI, services can be used to handle the processes that need to be done in the background. A service can be started by another Android application component such as an activity or other services and it will continue to run in the background even after the user switches to another application. Thus services are less likely to be destroyed by Android system to free resources, than Activities.

 There are two types of services in Android:

  • Unbound Services: It is a type of service which is not bounded to any components. Once started, it will run in the background even after the component that started the service gets killed.
  •  Bound Services: Its bound to other components and runs only till the component to which it is bounded runs.

3) Content providers: Content Provider are used to share data among several applications. You can store the data in the file system, an SQLite database, on the web, or any other persistent storage location your application can access. Then through content providers other applications are able to query, access or even modify the data you’ve created, as long as your content provider allows it.

4) Broadcast receivers: A broadcast receiver is a component that does nothing but receive and react to broadcast announcements. Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured and other applications can receive by using Broadcast receiver.

Activating Components:

 Intents: Intents are the activating components. The components — activities, services, and broadcast receivers — are activated by asynchronous messages called intents. An intent is an object that holds the content of the message. There are two types of Intents in Android:

  • Explicit Intents: Explicit intents designate the target component by its name.In explicit Intent, We specify which activity should get active on receiving the intent. These are usually used for application’s internal communications.
  • Implicit Intents: In implicit Intent we are sending a message to the Android system to find a suitable Activity that can respond to the intent. Implicit intents are often used to activate components in other applications.

Manifest file: Every application must have an AndroidManifest.xml file in its root directory. AndroidManifest.xml is a powerful file in the Android platform that allows you to describe the functionality and requirements of your application to Android. The manifest is a structured XML file and is always named AndroidManifest.xml for all applications. It does a number of things:

  • Informing the Android about the application’s components.
  • Declaring the application’s components, such as naming any libraries the application needs to be linked against.
  • Declare the hardware and software features used or required by the application.
  • Declare the minimum API Level required by application
  • Identify any user  permission the application expects to be granted

Please ensure the manifest is packaged with your app and includes the following elements and data:

  • Version Name
  • Uses- sdk
  • Uses-configuration
  • Uses-feature
  • Supports-screens

Android Architecture

Posted: August 30, 2012 in Android, Automation
Tags: ,

Android Architecture:

Android is a software stack for mobile devices that includes an operating system, middleware and key applications.

The following diagram shows the major components of the Android operating system:

 

Basically Android has the following layers:

Applications –Mostly applications are written in java and executing in Dalvik. Basic applications include an email client, SMS program, calendar etc. Any applications that you write are located at this layer. The application layer runs within the Android run time, using the classes and services made available from the application framework.

Application Framework: The developers have full access to the same framework APIs used by applications base. The architecture is designed to simplify the reuse of components.

Libraries: Mostly libraries are written in C, C++ used by various component of Android System. This layer includes:

Surface Manager: it manages access to the display subsystem and composites 2D and 3D graphics layers from multiple applications.

Media libraries: It supports playback and recording of many popular audio and video formats.

Free type: It supports Bitmap and vector font rendering.

SQLite : It is a powerful and light weight relational database engine which is available to all applications.

Runtime Android: Android includes a set of base libraries that provide most of the features available in the libraries of the Java language base.

Core libraries– The core Android libraries provide most of the functionality available in the core Java libraries as well as the Android-specific libraries.

Dalvik virtual machine-Dalvik is a register-based virtual machine that’s been optimized to ensure that a device can run multiple instances efficiently. It relies on the Linux kernel for threading and low-level memory management.

 

Linux kernel: This is the kernel on which Android is based. This layer contains all the low level device drivers for the various hardware components of an Android device. Core services (including hardware drivers, process and memory management, security, network, and power management) are handled by a Linux 2.6 kernel. The kernel also provides an abstraction layer between the hardware and the remainder of the stack.