Thursday, June 11, 2015

Common Challenges of Mobile App Testing

 7348035690_73473f4edc_zAnyone coming to mobile development after having worked mostly or exclusively on Web projects knows that there can be many stumbling blocks at the outset. The emergence of Swift – marketed as “Objective-C without the C” to highlight its resemblance to modern languages such as JavaScript –  for creating iOS apps may eventually help ease this transition. For now, though, there are still major shifts to make whenever pivoting to smartphones and tablets.
Outlining the challenges in mobile app development and testing
One of the overarching challenges of testing mobile apps, whether working with Objective-C on iOS, Java on Android or JavaScript with Phone Gap, is covering all bases when it comes to devices. This can be particularly difficult with Android and its highly fragmented ecosystem. Test cases have to be run for a wide variety of hardware, some of which may lack basic features such a gyroscope, as the game developers Game Oven recently discovered when porting Bounden to Android.
Speaking to Tech Target, Erdal Tuleu, director of engineering at imo, outlined how mobile app development has created new testing challenges such as ensuring that messages are delivered to multiple clients and endpoints. He stated that imo team members routinely run around with a “whole bag of devices” to vet each one’s peculiarities.
“In the past it wasn’t too common to have more than one station,” Tuleu told TechTarget. “People usually logged into their laptop or desktop and closed it before going home and logging in again there. Now it’s fairly common for people to have more than one station. For example, you can have it open on your laptop and again on your phone.”
It’s not just devices that are challenging. In a post for DeveloperEconomics, Jim Cowart lamented that developers often are unaware of what tools are available for helping them overcome common obstacles.
Unit testing in iOS, Android and PhoneGap/Apache Cordova
Take unit testing, which typically targets a small slice of code and assesses its behavior. Since unit tests are automated, they are a highly efficient way to look for problems such as regression bugs. Here’s how unit testing can be handled with iOS, Android and Phone Gap.
IOS
Writing for the M-Way Solutions blog, Marcus Kohler pointed out that unit testing tools are freely available and built-in to XCode. He provided the following code example of a simple unit test that would check whether a given topic existed:
(void)testThatTopicCanBeNamed {
Topic *namedTopic = [[Topic alloc] initWithName:
@”iPhone”];STAssertEqualObjects(namedTopic.name,
@”iPhone”,
}
@”the Topic should have the name I gave it”);
Overall, doing unit testing for iOS is inexpensive and requires minimal setup. Plus, the large selection of bundled tools means that teams usually have what they need to follow test-driven development approaches.
Android
Google recommends the JUnit framework for doing unit tests on Android. Various extensions can simulate Android elements.
Alternatively, there’s Roboelectric. It runs unit tests directly in the Java Virtual Machine. Tests can be done from the IDE and as part of continuous integration processes.
PhoneGap
There are numerous options for unit testing JavaScript, including:
  • QUnit
  • Mocha
  • Jasmine
  • except.js
Unit testers may also try out code using the PhantomJS WebKit browser. Like Roboelectric for Android, PhantomJS is easy to weave into a continuous integration workflow for automatic testing of the codebase.
Sources:

No comments:

Post a Comment