Thursday, August 27, 2009

Top 10 Tips For Testing iPhone Applications

This article started out as a Top 5 list but quickly grew as we researched all the tips and techniques we use at RTL for iPhone application testing. Most of these tips came from tracking down memory-related problems, which often resulted in defects that were very difficult to capture.

1. Accurately report available memory.  Many of the non-reproducible bugs you run into when testing iPhone apps are related to memory problems.  It's critical that you know and report available free memory before launching an application.  In all likelihood, the reproducibility of a crashing iPhone app bug is related to low memory conditions.  Consequently, a crashing defect may disappear when there's plenty of free memory.  In a previous article (Using Memory Sweep for iPhone App Testing) we described a tool that can be used to determine free memory.

2. Provide 'crash reporter' logs with your defect reports.  Each time an iPhone application crashes, a .crash file is created on your iPhone.  You can retrieve this file when you synch your iPhone with iTunes.  Here's a link that describes where those files are stored: iPhone Crash Logs

3. Spy on the app from the console.  iPhone apps will report application and system level warnings to the console.  You can view these warnings in real-time using Apple's iPhone Configuration Tool.  By knowing what's being reported when interacting with an app can help you refine the steps you need to reproduce tricky (and memory related) problems.

Wednesday, August 19, 2009

Mobile Device Application Testing Coverage Expands

The mobile device app space is expanding quickly. Testing for compatibility across different devices within a platform family and across platforms is becoming increasingly complex. Where will development and testing organizations draw the line?

Microsoft luring iPhone developers for Zune apps Developers being offered money to port their apps? If they are successful in luring iPhone developers, you can bet that these apps will need to be tested on both platforms. Are we entering another phase of supporting apps on multiple platforms?

Second webOS-Based Smartphone May Be Delayed Probably news to most that Palm's second webOS device is called the Palm Eos. Was to be available this fall and supposedly smaller than the Palm Pre. Will there be a significant update to webOS when the new devices arrive?

Microsoft Renaming Windows Mobile as Windows Phone
Windows Mobile, or WinMo, is expected to change names (WinPho?), probably to reflect Microsoft's new emphasis on its Zune and the mobile device market, particularly the iPhone market.

Dell Confirms Mobile Device Development Based on the rumors, this will expand the Android app market. Looks a lot like the iPhone in this picture.

Samsung's TouchWiz App Development Kit Hobbles Into the Light Samsung's TouchWiz app dev kit is out and it looks like it immediately expands compatibility testing across 3 different smartphone operating systems, Windows Mobile, Symbian and Samsung's own.

Wednesday, August 12, 2009

iPhone App Testing With iSimulate


The iSimulate iPhone app is interesting in so many ways. If you've read the articles posted about it (here's one from my favorite Apple blog, TUAW: iSimulate brings iPhone apps to the big screen), you probably were impressed by the idea of using your iPhone to control an iPhone app while watching it on a separate display. Playing a game on a large display while controlling it through an iPhone, as if the iPhone is some sort of game controller accessory, is intriguing.

And for the many iPhone app developers that are looking for a way to create marketing material of their app in action, iSimulate is probably just what they've been looking for. Recording your iPhone app in real time on a higher resolution display with actual motion inputs and then being able to later edit the recording has got to be better than the various video cam recordings one finds on YouTube.

Wednesday, August 5, 2009

Using Memory Sweep for iPhone App Testing

As mentioned in a previous article here (Testing For iPhone App Memory Problems), chasing down memory problems when doing iPhone app testing can be difficult. In particular, providing developers with concrete evidence that a memory issue is or is not their problem is a big challenge. Recently, while testing an iPhone app that was consistently presenting low memory alerts, we needed an independent memory assessment and discovered Memory Sweep, written by Gary Fung. It's a free app and works great for our testing purposes. Here's the information it provides you:


The numbers you see for Memory Status will help you diagnose memory problems when testing iPhone app. We used it for memory stress testing. We needed to force a low memory condition to see how an iPhone app behaved. Memory Sweep validated this process. We have a way of setting up iPhones/iPod touches so that memory is forced to be about 3-4MB. Once we do this, we launch Memory Sweep to make sure free memory is as low as we expected (you can see that free memory in the image above is 4.21MB), then quit and launch the iPhone app under test. In this way we can characterize our defects in a precise way so that the developer has confidence in the results.

When you read the reviews on Memory Sweep, you'll find that are very critical about the app. The main complaint is that the app is named Memory Sweep on the iTunes App Store and ends up being called "Scan" on your iPhone. From what I can tell, the critical reviews have been mostly about cosmetics and not functionality. There are plenty of positive reviews, particularly from those that appreciate the capability to force more memory on their iPhones. My main complaint is that this app only runs under iPhone OS 3.0. This will force us to find a similar app to run on older iPhone OS versions for our testing.

Thursday, July 30, 2009

A Lesson In Defect Characterization - How A Twitter Security Enhancement Created a Twitgoo Problem

Sometimes defects aren't what they appear to be. I'm sure developers have countless stories of how defects they set out to fix were not at all like the defect report described. We ran into just such a situation recently while testing a twitter-enabled iPhone App - Photo Tweet. Photo Tweet would mysteriously, and seemingly arbitrarily, fail to upload photos to Twitgoo. It was one of those situations where one day a feature works and the next day it fails. And, of course, the developer had not made any changes.

Most of the time when you find a bug and the developer claims not to have made any changes, it's always best to quiz the developer with "what-if" questions. That allows you, as a tester, to avoid calling the developer's integrity into question. I usually try questions like this:
  • What if during last night's build, an older version of a component was used?
  • Even though you didn't make a change for that feature, what if some other change caused this bug?
Usually this sort of brainstorming session can tease out needed clues that lead up to finding the root cause of a mysterious bug. If that doesn't work, then you're left trying to find out what else could have contributed to the defect. Such was the case with Photo Tweet and it's inability to upload photos after a period of time. And so, a bug was written up that said Photo Tweet would stop uploading photos arbitrarily.

Subsequent conversations with the developer, including some what-if questions, lead us to believe that no changes were made for this feature and the bug resided outside the developers code. Well since Photo Tweet uploads its photos to Photo Bucket's Twitgoo service, we suspected they had instituted some sort of throttling for uploads. This is reasonable to expect given the popularity of Twitgoo. Maybe they just didn't want rogue apps flooding their service, and apps like Photo Tweet were paying a penalty for the nefarious activities of others. We could not have been more wrong about the root cause of our defect.

We reported our defect to Twitgoo and asked if they had instituted an upload limitation. I was amazed at how fast these folks responded and how helpful they were. Initially they were stumped since this was the first they heard of this problem and HAD NOT put a limit on uploads. At that point, I expected that they could not help any further and we would be left with having to do more debugging. But instead, Michael P. Clark, their SVP of Technology and Partnerships rallied his technical folks to find out what was at the heart of this problem. The next day I got an email from Justin Hart, a Sr. Engineer for Photobucket, informing me that they discovered an unannounced change to Twitter's service. Twitgoo relies on Twitter for those users wanting to "tweet" the photos they upload to Twitgoo. It turns out that Twitter had made a security enhancement. Michael and Justin found this issue very quickly and pointed me to a threaded discussion concerning what Twitter did. Much to Twitter's credit, they quickly made this issue public and extended an apology and an offer for input from developers. Here's a snippet of their statement:
A change shipped last week that limited the number of times a user could access the account/verify_credentials method [1] in a given hour. This change proved hasty and short-sighted as pointed out by the subsequent discussion [2]. We apologize to any developer that was adversely affected. Given the problems, we want to fix this in a public and transparent manner.
We learned a lot from this experience. First, the folks at Twitgoo are fantastic and serious about providing a great customer and technology partner experience. Second, some defects are certainly not what they appear to be. Third, when testing products that use APIs that connect to services that connect to other services, it's hard to determine root causes no matter how well intentioned your defect characterization process is. Finally, as you investigate why a defect occurs, don't assume you know the root cause until you have all the facts.

Wednesday, July 29, 2009

Agile Testing Framework For iPhone App Development

As we continue developing and adding to our iPhone App Testing Lab, we are on the lookout for helpful testing tools. While doing some research on iPhone App testing tools, I ran across a post by a developer asking for help in this area:
My iPhone app has grown to the point where I need some sort of automated testing to keep me from breaking things whenever I make a change. I thought Instruments would do the trick, but I can't seem to make it work. What do you use for automated regression testing?

This is an appropriate question to ask, but one I would suspect results in an answer with a limited set of choices. In fact, the only tool we've come across, and posted an article about, is yet to be delivered (Squish Support For Automated GUI Testing on Apple's iPhone and iPod Touch).

Fortunately, as we all share information in blogs and forums, others points out additional solutions. In particular, one of our readers pointed me to uispec, Behavior Driven Development for the iPhone. I especially liked his comment "It's open source too.". That's always an attention getter for those of us looking for useful tools.

The author of this tool describes it as a "Behavior Driven Development framework for the iPhone that provides a full automated testing solution that drives the actual iPhone UI. It is modeled after the very popular RSpec for Ruby." For those of you interested in learning more this type of Agile development framework, take a look at Behavior Driven Development on Wikipedia.

When you visit the uispec link, you'll find documentation, installation instructions and examples. It looks like a great way to build in BDD testing for those of you that do continuous iPhone app development.

Thursday, July 23, 2009

Testing For iPhone App Memory Problems

Problems with memory management has got to be the #1 issue for iPhone app development, and presents one of the biggest challenges to testers. Our experience with testing over a half dozen iPhone apps in the past few months has reinforced the need for developers to nail down their memory management techniques early and for testers to create test cases that stress the way an iPhone app handles memory. So far the process has been bumpy but we've arrived at some basic memory management testing concepts along with recommendations for how developers can improve their memory management techniques.

Basically there are 2 types of memory problems to watch out for:
  1. Primary Memory Leaks (in the "sandbox")
  2. Secondary Memory Build-Up (out of the "sandbox")
Primary memory leaks are the most common and most troublesome to developers. These leaks create the mysterious crashes for iPhone apps in early development and are the hardest to document in a bug report, mainly because primary memory can change out from under the developer depending on other apps such as Safari and Mail. Safari can use up a lot of memory especially if multiple pages are open. Primary memory leak bugs seem to go away by simply restarting the application.

Secondary memory build-up creates situations that, over time, seem to create a permanently smaller amount of memory available for the app to run in, i.e. smaller primary memory. This does not come about because of memory leaks per se, and hence is harder to find with memory checking tools. As opposed to primary memory leaks, crashes or memory error alerts will seem reproducible for this type of memory problem. Consequently, the tester will write up repeatable steps leading up to the crash or memory alert, only to find out that, after restarting their iPhone, these steps will no longer be reproducible.

Our approach to rooting out these types of bugs is to first be able to identify them as categorized above, and then employ exploratory techniques to attempt to find reproducible steps. However, these memory issues can be elusive, and, as stated above, often lead to misleading bug reports. The main thing is to be able to communicate to development what type of memory issue you're seeing so they can use debugging tools to find the problem.

When we find these types of memory problems, our bug reports provide a summary, steps to reproduce, other apps that are running (i.e. Mail or Safari) and a result, e.g. app crashes or memory alert is presented. If the bug is not 100% reproducible, then we comment on where it mostly occurs. Our main effort is to write our bugs up so that a developer is convinced that it's a memory problem of some sort. Once convinced, then they can instrument their code to find it. But if you don't provide a bug report that describes the defect in the context of a memory problem, then the bug will most likely end up as "cannot reproduce" and be ignored.

We then recommend that the developers instrument their code to find the memory issues. But since we are testers, we can only go so far in what we recommend. It's been my experience that iPhone developers, when faced with memory issues, appreciate all the help they can get. Here are the links we send them to:
Most developers visit the Apple iPhone Developers Forum and it's a great place for testers too. By reading the posts there, you get a feel for just how tough memory management is. But more importantly, you gain confidence that bugs you are seeing really can be fixed and should not be attributed to peculiarities of the iPhone. Apple developers write a lot of responses in those forums to help counter the claims that the OS is to blame for all these memory problems.

By understanding memory problems, testers can be authoritative in their defect reports. By knowing where to point developers for help, the test group becomes a resource for helpful investigation and research for tough memory problems.

Wednesday, July 15, 2009

Gearing Up To Develop and Test Palm webOS Apps

Palm and O'Reilly are offering developers and testers a look at the Palm webOS and what it takes to develop for the platform. You can get a sneak peek overview of webOS here, where you can learn how the OS works and the terminology for the UI. Basically, webOS is an embedded Linux operation system with a custom UI built on a browser. I think the biggest deal about this device and its OS is the underlying development environment embodied in their Mojo SDK. Mojo offers a JavaScript framework that provides standardized UI widgets, and access to selected device hardware and services. I think this will attract a lot more developers to the platform than other devices because of JavaScript, versus Objective-C or Java. However, it's not the language choice that attracts developers - it's the richness of the device and its APIs. From the looks of things, Palm's webOS brings a lot to the party. Moreover, developers are free to develop their apps from scratch if they don't want to use Palm's SDK.

If you are looking to catch up on webOS and the Mojo SDK, then I recommend watching Mitch Allen's (Palm's Software CTO) presentation on webOS development. In the video below, he gives a preview into application development with the Mojo SDK, the development environment and toolset for this new mobile web platform.