Category Archives: enterprise

Automated UI Testing in PhoneGap Apps

I normally don’t write posts to talk about a specific product from another company, but this is the first product that I have seen which lets you do automated UI testing in PhoneGap applications, so I figured I’d share…

Automated testing is often a critical step in enterprise application development. I’m sure most everyone out there is familiar with automated unit testing, where you write specific code to test and validate business logic or processes within your application. This can be done on the client side or on the server side, and there are lots of existing tools and languages that can be leveraged for automated unit testing.  For PhoneGap applications, you can write unit tests that evaluate your JavaScript logic to verify proper behavior in your apps using a number of tools, but these only test JS execution and logic.

Automated UI testing enables you to test the GUI of your application. It allows you to make sure proper buttons or controls are displayed wherever they are supposed to be displayed, that they have the proper user interaction, and generally that your application’s user interface is functioning properly. There are numerous tools to enable automated UI testing on the desktop by recording user input and turning that user input into reproducible scripts. However on mobile devices, there aren’t as many options. You can write code to create test scripts for both iOS and Android, but writing these tests for PhoneGap applications could get challenging.

Recently, while attending the 360iDev conference, I was introduced to Telerik’s Test Studio for iOS applications. At first glance, I thought “oh, that’s cool, automated ui tests for native iOS apps”, but doubted it would work with PhoneGap apps. It turns out I was wrong. You can use it to record and automate UI tests for native, web, or hybrid iOS applications. Below is a video of it in action with the “Walkable” PhoneGap app that I recently released.  You can record test scripts, and play them back at any time, and it will evaluate whether the test was a success of failure if the UI responds as it did in the original script.

Test Studio allows you to capture user input in your iOS application and play it back as a script without touching or interacting with the application yourself.  There are just a few steps to get it up and running:

  • Download and install Test Studio application and mobile testing SDK.
  • Configure a testable build of your application – Note: Do not follow the “quick instructions” in the confirmation email you get when you download the SDK – it left out a step, follow these instructions instead.
  • Deploy your app to your device.
  • Launch Test Studio, and follow the UI prompts to “Record A Test”.
  • At any time, access and execute any existing script.

However, be forewarned, it is not seamless and error-free. I’ve noticed in testing my own applications that when executing recorded scripts, Test Studio often attempts to execute steps before my HTML DOM elements actually exist.  This is a common issue in automated UI testing, especially when testing single-page dynamic HTML applications – regardless of whether they are PhoneGap or in a desktop browser. You have to be very deliberate and precise when you record your steps, and at certain points, I had to manually introduce a wait period in the script to enable enough time for my HTML DOM elements to be created.   In Test Studio, there are a few ways you can do this:

  • Introduce a finite “wait” duration
  • Test to see if the HTML elements exist before continuing with script execution

You can also go back and edit/add steps to existing tests.  It can be a painstaking process to record accurate UI test scripts, but can be useful for QA processes for many applications.

US Census Browser v2.0

I am happy to announce the US Census Browser version 2.0!  Back in December of 2011, I released the US Census Browser as an open source application intended to demonstrate principles for enterprise-class data visualization and applications developed with web standards.  This version has some fairly substantial changes – See the video below to check out features in the latest version:

Version 2.0 is currently available for:

Version 2.0 of the US Census Browser has some substantial changes, including:

  • Completely new & redesigned UI layer, using app-UI.  app-UI is an open source framework for application view-navigators that mimic native mobile applications.   Using the app-UI SplitViewNavigator, the US Census Browser now supports both landscape and portrait orientations.
  • Switched from Google Maps to Open Street Map using OpenLayers.  Users of the Census Browser maxed out my Google Maps account!  That is 25,000 map loads within a 24 hour period! WOW! I switched to the free Open Street Maps solution, which doesn’t have any usage/bandwidth limitations.  With this change I was also able to add interactive maps.
  • Updated to Twitter Bootstrap 2.0.  The app is now using new UI styles and components which are now available in Twitter Bootstrap version 2.0

The source code for the US Census Browser has also been updated on github: https://github.com/triceam/US-Census-Browser

To learn more about app-UI, check out my page here: http://www.tricedesigns.com/2012/04/24/introducing-app-ui/

Enjoy!

Introducing the US Census Browser Application

I’d like to take this opportunity to introduce you to a new project I’ve been working on to showcase enterprise-class data visualization in HTML-based applications.   The US Census Browser is an open source application for browsing data from the 2010 US Census.

The app is completely written using HTML and JavaScript, even for the charting/data visualization components. You can check it out in several application ecosystems today:

Apple iTunes: http://itunes.apple.com/us/app/census-browser/id483201717
Google Android: https://market.android.com/details?id=com.tricedesigns.CensusBrowser
BlackBerry App World: http://appworld.blackberry.com/webstore/content/69236?lang=en
Amazon App Store: http://www.amazon.com/Andrew-Trice-US-Census-Browser/dp/B006JDATOY/ref=sr_1_1?ie=UTF8&s=mobile-apps&qid=1323874245&sr=1-1 (this includes support for Kindle Fire)

Support for additional platforms is planned for future development. Future targets include BlackBerry Playbook as well as Android 2.x devices, including the Amazon Kindle Fire and Barnes & Noble Nook Color – Android 2.x does not support SVG graphics in-browser, so I am working on some alternative features.

Update: Kindle Fire and Playbook have been approved, and are now supported. See links above.

You can also view the US Census Browser application in your desktop or mobile browser at: http://tricedesigns.com/census/

Please keep in mind that this application was designed for mobile devices.  Internet Explorer in particular does not work well with the Census Browser – use at your own risk.   The browser-based application has been tested and works properly in the latest versions of Chrome, Safari, Firefox, and Opera.   The US Census Browser application also does not work in Android 2.x and below, due to the fact that these versions of Android do not support SVG graphics in the mobile browser.

Full application source code for the HTML/JS interface and ColdFusion backend system are available at https://github.com/triceam/US-Census-Browser under the terms of the “Modified BSD License”. Be sure to review the README if you want to get this running on your own.

APPLICATION OVERVIEW
The application is essentially a single-page web site, which asynchronously loads data from the backend upon request, and displays that data to the user. The main application file is index.html, which loads the UI and appropriate client-side scripts. The main presentation logic is applied via CSS stylesheets, and the application control is handled by the ApplicationController class, inside of application.js. The ApplicationController class handles state changes within the application and updates the UI accordingly. The main data visualization and data formatting logic is all contained within the censusVisualizer class, which the ApplicationController class uses to render content. All DOM manipulation, event handling, and AJAX requests are performed using jQuery.

The data visualization is implemented 100% client-side, using the Highcharts JavaScript library. Highcharts renders vector graphics client-side, based upon the data that is passed into it. Check out the examples at: http://www.highcharts.com/demo/ for a sample of what it is capable of.

The fluid scrolling and swiping between views is implemented using the iScroll JavaScript library. Note: I’m using iScroll-lite.js. This is a great resource for any HTML-mobile, or mobile-web applications.

PHONEGAP USAGE
The client-side runtime does not have any dependencies for access to device-specific functionality. However, PhoneGap is being used as an application container so that the application can be distributed through various mobile “app stores”.

SERVER-SIDE
The back-end of this application is written using ColdFusion. Yep, that’s right. I used CF. In fact, the server side is ridiculously simple. It is only a single ColdFusion Component (CFC), with three remotely exposed methods for accessing data, and relies upon CF’s built in functionality to serialize JSON. CF is incredibly powerful, and made this project very simple and quick to develop.

Feel free to check it out on github: https://github.com/triceam/US-Census-Browser
You can also check out more technical details at: http://www.tricedesigns.com/2010-census/

Visualizing Complex Enterprise Data in a Tablet World

My recent Developer Deep Dive webinar “Visualizing Complex Enterprise Data in a Tablet World” is now available on the Adobe Enterprise Developers Portal.   In this webinar, I walk through the fundamentals of a rich, enterprise-data driven mobile experience, powered by Flex, AIR, LCDS, & LCCS.

Take a look at this short clip to get a feel for what’s covered in this webinar…

(Mobile Maps powered by ESRI)

Now, go view the webinar in its entirety to check out how this experience was built:
http://enterprise-dev.adobe.com/edev/en/webinars/archive.html#mobile

Grab the source code here:
https://github.com/triceam/Enterprise-Tablet-Visualization