Category Page

Uncover Memory Leaks by Mobile Apps

 

Mobile apps can often crash for many reasons. Nothing is as excruciating as memory leaks. It starts with your app crashing often, or becoming slow or maybe making your entire phone slow down, taking longer time to load activities. Memory leaks are notoriously hard to detect, and thus can easily surprise you. Have we ever thought why most of the users uninstall the application after some use?

Which is why it is critical for Developers to understand the memory consumption by any mobile application. How do you detect memory leaks during Mobile Application Testing? And if so, how can you prevent them from hogging mobile resource consumption?

A little knack for Mobile Application Testing always comes handy.

 

mobile application testing
Figure 1: Image Credit- GadgetHacks

 

Want to test your Mobile App?

Join pCloudy Platform!

Memory is critical to device

 

Memory is one of the key resources of the mobile device.And memory leaks in Android is an important thing to be kept in mind. Java is a garbage collecting language, which removes the need for developers to dig deep to manage allocated memory. This reduces the chances of any segmentation fault crashing an app or any unfreed memory allocation from eating up space of the heap area, thus creating a safer code.

 

However, a garbage collector is never an insurance against memory leaks. There are other ways by which memory can be leaked within Java. This means that your android mobile application is still pretty prone to wasting unnecessary memory allocation and crashing with out-of-memory (OOM) errors.

 

Toptal
Figure 1: Image Credit- Toptal

 

Why are Memory Leaks Bad?

 

Cause: Memory leaks occur when some variable of the application still has references to some objects that are unnecessary, no longer in use or used to be with the app anymore, is bloating the allocated memory heap and the Garbage Collector is not being able to release that memory.

Effect: Android devices mostly run on phones with limited memory, so as a result of too many leaks, the app runs out of available memory. This triggers more frequent Garbage Collector events which paralyze the device (Stop-the-world GC events) by almost stopping the rendering of UI and processing of events. This leads to an Out of Memory Exception and translates to the user as the app being unresponsive.

 

Android App Testing

 

Testing for Memory Leaks

 

Memory Leaks are caused by the failure to not be able to de-allocate memory that is no longer in use, which is why they cannot be identified during black box testing. The best phase to find the memory leaks is when developers are developing the application, at a code level.

It’s best to check for memory leaks during unit testing. However, testers can follow these tips:

 

Release Unused Memory: Memory leaks can be present because of the bad design of the application and thus might consume lot of memory when the application is in use

 

Test on Multiple devices:The memory consumption by the application should be monitored while doing the system & functional testing. One shouldn’t rely on a single device testing as there are plethora of devices in the market.

 

Detecting Memory Leaks

There are quite a few techniques and tools devised by developers to pin point memory leaks. Android’s very own Android Studio has a powerful tool to monitor not only memory usage but also for network, GPU and CPU usage as well, called the Android Monitor.

Memory Monitor in this helps track memory usage, find de-allocated objects, identify memory leaks and helps get an overall sense of how your app allocates and frees memory. It’s done in three steps:

1. During and use and debugging of app, track the memory monitor. If the memory usage graph rises for your app and doesn’t fall even if put in background, it’s a memory leak.

2. Using the Allocation tracker, you can check the percentage of memory allocated to different types of variables in your app. This gives you a sense of how much memory is consumed by which object.

3. Create a Java Heap Option to create a heap dump that keeps a snapshot of the memory at any given point of time, thus providing the data consumption data.

Despite Android’s monitor to detect memory leaks, there are a few platforms from developers that help extract memory consumption data without so many steps for faster testing cycles.

pCloudy’s very own platform for example, generates the statistics for Memory consumption while doing the normal functional Mobile Application Testing on real mobile devices.It also generates other vital data such as CPU consumption, battery consumption & data consumption for testers and developers who reiterate several test cycles across multiple physical devices.

 

mobile application testing
Figure 1: Image Credit- Android Developers Studio

Want to test your Mobile App?

Join pCloudy Platform!

Mobile Automation Testing

 

pCloudy provides you the cloud platform to perform Automated Testing on Real Mobile Devices. To schedule automated testing over pCloudy, go to the Automator page. Here, you can use filter your devices based on mobile OS (android/iOS) and test automation framework (Calabash/Robotium). Further, you need to choose application file (.apk/.ipa), zip file of test script, enter time duration (default – 15 minutes), test cycle name (default – Test cycle). Now, browse, select and add desired device(s) to schedule test automation.  When test automation gets completed, you will get an email reminder for the test completion.

 

Mobile Automation Testing

What’s New with 3.0

 

We have been continuously working towards a mission to create a world class yet affordable platform for testing of apps in connected world.

In this journey we are committed to bring you best of features to make your App testing quicker, easier and cost effective.

I would like to introduce PCloudy 3.0, our latest release. So, what’s new here?

IOS support

We have added latest IOS devices on our platform which means you can test your IOS apps on real devices exactly the same way you tested your Android apps. You can find latest devices like IPhone 6S, IPhone 6 plus and IPad Air 2. Moreover, you can find IOS devices with older versions as well.

IOS devices

Appium support

Running your Mobile App automation was never so easy. Now you can focus on building your scripts. Leave the execution to us. Just create your Appium scripts in Eclipse or using your own framework. Insert a small piece of code within your script and you are ready to run your scripts on multiple devices in parallel.

Appium support

Test your Apps on real Network

We have enabled real network on many of our devices. Now, you can test your Apps across 2G, 3G, 4G and wifi across various network providers.
You can switch between networks while executing your test cases.

On-device performance Metrics:

This has been a big pain area of testers and developers. How to measure and analyze resource consumption (CPU, Memory and Network consumption) for App on a real device. Well, it’s a click away on our platform.

On-device performance Metrics

Latest Devices:

We are constantly updating our device matrix to provide our customers latest and greatest devices available in the market.


Improved Performance:

Our commitment is to provide you a working experience as close as possible to a real device. We have done many perf improvements on our platform. Moreover, we moved to a new Data center. It’s an ISO 27001 certified Data center with 99.99% uptime commitment.

“iOS 8 is the biggest iOS release ever — for developers and everyone else. But that wasn’t the goal. We simply set out to create the most natural experience. Each enhancement has a purpose. Every new feature deserves to be a new feature. Each function is more considered, each next step is more efficient. It all adds up to an even better experience — one that is pleasantly surprising at first and becomes utterly indispensable before you know it.”

What is new ?

Inter-App Communication

Inter-app communication means different things to different people. For some it’s the ability to push files from one app to another. For others it’s the ability to pull data into any field in any app. The core issue, however, is workflow. People just want an easier way to move their stuff around.

Touch ID Authentication

Touch ID is the name of Apple’s personal fingerprint identity sensor. It’s what currently lets you authenticate yourself to unlock your iPhone 5s and authorize iTunes and App Store purchases on your account.

 Custom keyboards

After years of waiting, Apple has finally brought support for third-party keyboards to iOS. Inside iOS 8, keyboards like Swiftkey and Swype, which have enjoyed huge usage on Android, will have system-wide access to all apps and services on your iPhone and iPad. Swiftkey has confirmed it’s onboard, but if you don’t fancy that, you’ll still able to enjoy Apple’s new QuickType keyboard. The company says the improved keyboard learns from the way you type and text, offering a pick of suggestions for your next word based on the content of your message or the person you’re conversing with. Planning a meal with your friend or loved one? The keyboard will auto-populate words like “dinner” or “eat” as you type. At launch, QuickType will support 14 regions including the US, UK, Canada, Australian English, Brazilian Portuguese, Chinese (that includes Hong Kong and Taiwan), French, German, Italian, Japanese, Spanish and Thai.

Family Sharing

New to iOS 8, a user can add six others as family members. Family members can share purchased apps, music, and books using the same credit card. iOS 8 can also automatically set up photo streams for all family members. Calendars may be synced between all members. Kids can also send iTunes download requests for apps, music, movies, and more to their parents provided this service is set up correctly.

Third-party widgets

iOS 7 split notifications and widgets apart, putting widgets in their own Today view, moving Weather to the Today Summary, and adding support for Calendar, Reminders, predictive location, and the Tomorrow Summary. Yet they were still limited to built-in apps and services.

iOS 8 and Extensibility take it even further, allowing App Store apps to offer up their own Today view widgets — helpful information status indicators, simple, interactive utilities, and ways to launch into the full app when and if needed — easily accessible from anywhere on the iPhone or iPad, informational and interactive.

What a new OS or device release means to the developers and Testers?

Update Your Device/OS Test Matrix

Maintaining Device /OS Test matrix is already a big challenge for organizations. It is always a big question that what device and OS combination should be included in the Test Matrix and what should be not. One way to set your Matrix in right direction is you can take the help of Google analytics that what devices your audience/users are coming from.Now each OS Device release we have to refresh this Matrix.

How should we proceed and what all areas we should focus more:-

Functional Testing

According to Apple’s developer site “iOS 8 includes over 4,000 new APIs that let you add amazing new features and capabilities to your apps. Deeper integration with iOS means you can extend the reach of your app content and functionality.”

Inter App communication

Test if your application is able to interact seamlessly with other apps and Able to transfer Data from one app to other.

Notification center

If your app is using Notification API it is properly updated in Notification center and your application is able to customize its Notifications in Device Notification center.

Touch ID Authentication

If Your Application is using Touch ID Authentication the is it working fine as per your implementation

A/B Testing

App Login with Touch ID

In iOS 8 developers can now use Touch ID to let their users log into their app. Typing in a password introduces a lot of friction into the signup flow, but Touch ID is also a new technology that isn’t perfect every time.
Just because Touch ID is available for app login, doesn’t mean it’s the best option for every user. Set up a simple A/B test to see how leading with one option vs. another impacts sign-ins and sign-ups. Depending on who your audience is and how they use your app, you may be surprised by the results.

Let’s face it; Touch ID doesn’t always work as promised. It’s important that your app respond before your users start to get frustrated and consider abandoning. Try testing different options for help text and UI elements to guide your users to a successful entry.

Extended Sharing Options

iOS 8 now lets developers share content from their apps with a new sharing options API. This release comes a big question: where will developers embed sharing actions? and what type of actions with sharing surface?

We recommend experimenting with different places in your app you can surface the option to share. Make sure you pick a consistent place that makes sense for users as part of their interaction flow. This can be hard to know for certain, so we recommend brainstorming some options with your team and testing as many as you can.

The types of actions you surface in your sharing options is also really important. Too many actions will clutter the experience and confuse people, threatening drop off. Think about the high-value actions you want your users to take. Start by highlighting only those. Then, progressively test into adding other actions based on user feedback and team ideas. If you start to see adding actions are negatively impacting your engagement, you know you might be going too far.

UI Testing

 

Remember these points before Testing

Size Class

With iOS 8, Apple is introducing “size classes”. Size classes have vertical and horizontal dimensions called “regular” and “compact”. The iPad in both portrait and landscape defaults to the regular size class in both horizontal and vertical directions. The iPhone in portrait defaults to compact size class for horizontal and regular size class for vertical. The iPhone in landscape defaults to compact size class for both horizontal and vertical.
Apple provides some automatic behaviors based on size classes. For example, if you rotate an iPhone app that uses standard components from portrait to landscape (from compact/regular to compact/compact) the navigation bar gets condensed and the status bar disappears entirely. That’s to maximize the content on a screen that’s suddenly gone from being tall to being very, very short — like a web page on Safari.
Developers are free to customize the layout for every orientation of every device they support as well. For example, they can have two buttons stacked on top of each other in portrait orientation to take advantage of the height, and those same buttons aligned side-by-side in landscape orientation to take advantage of the width. They’re the same controls, their position and other attributes simply change as the vertical size class changes.

Split view

Apple is also bringing split views to the iPhone. That means developers no longer have to maintain two separate interface hierarchies, one for iPad that contains split view, and one for iPhone that does not. Now they can maintain one hierarchy for both and the proper screens will all be rendered based on size class.

Changed UI API’s

With iOS 8 Release Apple has removed some of the UI API’s and a list of bug fixes in UI KIT made it very essential for user’s to test the UI thoroughly.

Orientation

You need to test the rendering of their application as per the changed classes and views

UX Testing

Enhanced Multitasking

iOS 8 comes with enhanced multitasking functionalities. Testing your app user experience with this enhanced Multitasking feature of iOS 8.

iOS 8 Touch ID authentications

Testing the user experience of your application with iOS 8 Touch ID authentications functionality.

Notification Center

How Your Application Notification pushed into Device Notification center or What happens when your Device is in Locked state etc.

Performance Testing

CPU usage by Your Application on this new OS and device.
App performance during interaction of one app with others.

Security Testing

Security will also be a major focus of this release. New iOS 8 features will make it even easier to keep track of all your passwords and make sure they are as secure as possible