Posts Tagged ‘appium’

Guest Post: All About Mobile Continuous Integration

April 20th, 2015 by Bill McGee
mobile_devices_continuous_integration

Image credit: Loris Grillet

CI’s not a new thing. Wikipedia says the phrase was first used back in 1994, way before modern mobile apps. Today it’s commonplace in many dev shops for developers to expect that their code is automatically tested when they commit and even automatically deployed to a staging environment.

For mobile developers though, it’s been a slow road to adopting many of these same practices.  In large part, this is because mobile brings with it a whole set of unique challenges that make implementation tough.  Nevertheless, tools have evolved a lot and mobile dev teams get a lot of value and goodness from having a solid CI system in place. Here are my top 3 reasons for using CI with the mobile products I work on: (more…)

Applitools Recognizes 16 Influencers + Thought Leaders in Test Automation

April 2nd, 2015 by Bill McGee

Test Automation Top Influencers and Thought Leaders_500wSaucesome news in the automated testing world! Our friends at Applitools recognized several Sauce employees and friends in their Top 16 Influencers and Thought Leaders in Test Automation list, including our Co-Founder Jason Huggins, Director of Ecosystems and Integrations Jonathan Lipps, and Selenium expert Dave Haeffner.

Applitools stated, (more…)

Appium Version 1.3.7 Released on Sauce Labs

March 26th, 2015 by The Sauce Labs Team

Appium logo w- tagline {final}-01

We’re pleased to announce that Appium version 1.3.7 is available on Sauce. This small release includes two hotfixes:

General

  • fixed a failure to remap session id in proxied responses

iOS

  • fixed intermittent failure to find Xcode

Repost: Lessons Learned from Automating iOS Apps – What To Do When Tests Require Camera Roll Resources?

March 18th, 2015 by Bill McGee

This post comes from our friend Jay Sirju at Animoto, who is leveraging Sauce, Appium, and CI methodologies to automate mobile testing for their iOS application.  Check out the original post on their blog.

Here at Animoto, the mobile application development team had spent some time over the past year investigating and implementing CI methodologies into the development cycle of the Animoto Video Maker application for iOS. A major part of this initiative involved creating automated test cases that would run at various times and circumstances.

First a bit of background. When we started this, we had already implemented a good amount of automation for the Animoto website. We had chosen to use Selenium and ran our automated tests against various browsers using Sauce Labs. We decided to extend our existing infrastructure to support running automated tests using theAppium library against Sauce Labs.   For those unfamiliar with mobile testing on Sauce Labs, they use the iOS and Android Simulators to run tests. I know, not ideal, but we can get to that another time.

The Problem

For anyone who has ever launched a fresh iOS Simulator (before Xcode 6), the OS is in it’s factory state. The Animoto Video Maker App transforms your pictures, video, and text, into professional looking videos… see where I’m going?

Screen-Shot-2015-02-18-at-11.31.04-AM

A lot of user flows depend on having some photos in the camera roll. A factory-fresh simulator without any photos means there are man flows we can’t automate. Unfortunately, at the time of writing, Sauce Labs does not have a way to upload assets to populate the Camera Roll, and the simulators are reset after executing each test case. Starting with XCode 6, the Camera Roll does have some images out of the box, but what was really needed were meaningful pictures and videos. So what is needed is a way to populate the Camera Roll while working within the constraints of running tests in Sauce Labs. Well, the app already reads images and pictures from Camera Roll, what about writing to it as well?

Adding or Altering Configuration Profile

Before we get to actually populating the Camera Roll, we need a mechanism to ensure that this logic is performed only when the intent is to run automation. Out of the box, Xcode provides 3 build configurations (Debug, Release, and Distribution). We can edit these configurations, add new ones, or even delete unnecessary ones. In this case, we can simply add a Test configuration to the mix. Once we did that, we were able to change various build settings to help create hooks for app automation. We can start out by adding a Preprocessor Macro for the Test build configuration, so that we can tell the pre-processor when to compile test hooks into the build.

animoto 2

Okay, now we can do some fun stuff with the build. For the sake of brevity, let’s focus specifically on the original issue: Getting pictures and videos into the Camera Roll.

Change Test Configuration Profile Settings

First things first – how does one get pictures and videos up to Sauce Labs? We can simply add them to the iOS project, but that would increase the size of the application bundle regardless of which build configuration is being used. Definitely not ideal. A better choice would be to store them somewhere externally and copy them to the application bundle when the Test configuration is used. This can be done by running a script when building the project.

[code language=”ruby”]if [ ${CONFIGURATION} == "Test" ]; then
cp -r ${PICTURE_AND_VIDEO_LOCATION}/ ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
fi[/code]

Populating the Camera Roll

Now we have an application bundle that contains a bunch of sample pictures and videos. This is great because when the application gets uploaded to Sauce Labs for testing, so do all the sample data.   The following code example assumes all the sample images are in a folder within the application bundle named ‘TestImages’:

[code language=”ruby”]+ (void) populateCameraRoll
{
NSString* absolutePicturePath = [[NSBundle mainBundle] pathForResource:@"TestImages" ofType:nil];
NSArray* pictureList = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:absolutePicturePath error:nil];

for(int i = 0; i < [pictureList count]; i++)
{
NSString* absolutePictureFilePath =[ NSString stringWithFormat:@"/%@/%@", absolutePicturePath,[pictureList objectAtIndex: i]];

NSData *jpeg = [NSData dataWithContentsOfFile:absolutePictureFilePath];

UIImage *image = [UIImage imageNamed:absolutePictureFilePath];

CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)jpeg, NULL);
CFDictionaryRef imageMetaDataRef = CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
NSDictionary *imageMetadata = CFBridgingRelease(imageMetaDataRef);
CFRelease(source);

if (image != nil)
{
ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
dispatch_semaphore_t sema = dispatch_semaphore_create(0);

[library writeImageToSavedPhotosAlbum:[image CGImage] metadata:imageMetadata completionBlock:^(NSURL *assetURL, NSError *error)
{
dispatch_semaphore_signal(sema);
}];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
});
}
}
}
@end[/code]

The above code makes a bunch of assumptions. First, it only works for images. Another folder consisting of sample videos can be created, and the using similar logic and the writeImageToSavedPhotosAlbum method. Next, calling writeImageToSavedPhotosAlbum can indeed fail. For the sake of keeping this example code more readable, error handling was excluded. Retry logic should be included if an error is returned.

Finally, you may have noticed the use of a semaphore in the example code. Writing images to the Camera Roll is actually an asynchronous call, meaning that the call returns immediately while a separate thread processes writing the image data to the Camera Roll. The writeImageToSavedPhotosAlbum method can fail if there are too many threads trying to write image data simultaneously. The semaphore is used ensure that images are written to the Camera Roll sequentially. This makes using the writeImageToSavedPhotosAlbum method much more stable.

Okay, so now that is left is to call the method when running the Test configuration. This can easily be done using the Preprocessor Macro setting that was above mentioned.

[code language=”ruby”]#if TEST
[ANTestClass populateCameraRoll];
#endif[/code]

It is recommended to call the method somewhere deterministic (ie -a button tap). Simply populating the Camera Roll at start-up may mess up launching Apples Instrumentation library because of the Alert displayed when the app accesses the Camera Roll for the first time. This lesson was learned the hard way.

This opens up the ability to add more automated test hooks into the application under test, but as a word of warning; the more hooks added, the more the test configuration of the app diverges from what is being released to customers.

 

Have an idea for a blog post, webinar, or more? We want to hear from you! Submit topic ideas (or questions!) here.

Appium 1.3.6 Available on Sauce

March 4th, 2015 by The Sauce Labs Team

Appium logo w- tagline {final}-01The Appium team is pleased to announce that version 1.3.6 is now available on Sauce.  The new build includes changes from 1.3.5, which was previously unavailable for Sauce users.

iOS
– fix for a bug when driver.get() never returns for page with alert.
– iOS 8.2 support.
– fixed safari startup crashes.
– ensure Appium drops into the right continuation cb when selecting hybrid contexts.

Android
– fix XPath regression where Appium failed to recognize non-ASCII characters.
– fix regression where Appium failed to set ADB’s path during Chromedriver tests.
– now finds the location of adb earlier.
– ensure encoding stream in Bootstrap.jar closes correctly.
– add workaround for issue where UiAUtomator fails to find visible elements.
– fixed undefined member error for the release object.
– add a delete key test.

Selendroid
– upgrade to Selendroid 0.13.0.

Don’t Miss This Appium Workshop At Mobile+Web DevCon On February 3 [Click For Discount Code]

January 19th, 2015 by Bill McGee
Appium logo w- tagline {final}-01
Attending Mobile+Web DevCon in San Francisco February 3-5? Join Isaac Murchie of Sauce Labs for a 3-hour Appium workshop before the main event on February 3 at 1:00 PM Pacific Time.

In this Lab, you will get a hands-on demo showcasing how to use Appium, a free open-source tool for automating mobile testing, that will highlight the following:
  • An overview of the tools available for writing tests in JavaScript, although you should note that with Appium you can test native, hybrid, and mobile web apps in any coding language and with any test framework.
  • Understand how to write tests in JavaScript in order to test web applications in mobile environments.
  • Learn how to execute your tests against the cloud of devices at Sauce Labs.
  • Discover the value of automated testing, including increased reliability of your applications as well as how to tune performance on different platforms.

(more…)

Vote To Help Appium Win A DeveloperWeek Award

January 9th, 2015 by Bill McGee

Appium logo w- tagline {final}-01Crowd voting for DeveloperWeek awards is open and will continue through January 15th. Appium was thrown into to the mix as a mobile developer tool of choice, so we’d love your help with voting! Appium is an open source, cross-platform mobile automated testing tool that was developed by Sauce Labs and a thriving community of open source contributors.

Voting is easy. Just follow these four steps:

  1. Register HERE to vote;
  2. Then, visit the Appium nomination page HERE;
  3. Click “Endorse” to vote for Appium;
  4. Share with your network.  Here’s some suggested copy:
    • Twitter: Help  win a award! Click here to vote until 1/15: http://ow.ly/H5fog 
    • LinkedIn: Help Appium, sponsored by Sauce Labs, win a DeveloperWeek award! Click here to learn how to vote until January 15th: http://ow.ly/H5fxJ
    • Google Plus: Help #Appium, sponsored by #SauceLabs, win a #DeveloperWeek award! Click here to learn how to vote until January 15th: http://ow.ly/H5fiu #mobile
    • Facebook: Help #Appium, sponsored by #SauceLabs, win a #DeveloperWeek award! Click here to learn how to vote until January 15th: http://ow.ly/H5ftV #mobile

.

Mobile Testing Talk: What’s New With Appium [RECAP]

December 19th, 2014 by Bill McGee

appium_logo_with_sauce_NEW

Thanks for joining us last week for our latest webinar, Mobile Testing Talk: What’s New With Appium, which featured Jonathan Lipps, the Chief Architect for the Appium Project.

To recap, Jonathan gave listeners a tour of Appium version 1.3.x, including the stability improvements and features the team has added since the Appium 1.0 release back in May of 2014. He also touched on the following:

  •  Appium 1.3.x release features and improvements
  •  New platforms
  •  Better hybrid support
  •  Examples of maturing Appium clients & more

We had great feedback on the content and an influx of interesting questions that got addressed in the Q&A at the end.

Missed the webinar, need to hear it again, or want share it with your team? Check out the slides below (more…)

Mobile Testing Talk: What’s New With Appium [WEBINAR]

December 10th, 2014 by Bill McGee

appium_logo_with_sauce_NEW

Developed by Sauce Labs and a thriving community of open source contributors, Appium is a cross-platform automation framework for testing mobile web, native, and hybrid applications. (more…)

Appium 1.3.4 Released on Sauce Labs

December 4th, 2014 by Bill McGee

appium_logo_with_sauce_NEW

Appium version 1.3.4 was released on Sauce Labs today. Below is the list of updates, or you can always head over to Github for the latest.  (more…)