Tag

android Archives - Falafel Software Blog

Building Mobile UI Tests using REPL

By | Android, Testing, UITest, Xamarin | No Comments

This is post 4 of 4 in the series “Xamarin Test Cloud” Building Mobile UI Tests using REPL REPL builds a list of methods to automate a mobile app for use in a UI test. The typical workflow starts with the tree command to list elements in the current view. Next, app methods wait for elements, enter text, tap buttons and so on. Then the copy command saves your REPL activity to the clipboard. Finally, you paste REPL commands into your test method. Once you paste the REPL output, you can clean it up and add assertions.

The screenshot shows the Android emulator on the left, and…

Read More
Xamarin UITest Word Cloud

Mobile Testing in the Xamarin Test Cloud

By | Android, Android, C#, iOS, Testing, UITest, Visual Studio, Xamarin, Xamarin Test Cloud | No Comments

Mobile UI testing requires the same power as web UI testing. Certainly we need the basics: identify on-screen elements, automate, and make assertions. But that’s not going to be enough for teams building mobile apps under rapidly changing conditions; not with hundreds of new, evolving technology combinations. So what are the new rules? Here’s what we need, right-out-of-the-box…

Read More

Accessing Android Application Context outside Activity in Xamarin

By | Android, Android, Xamarin | No Comments

In Android world, it’s quite common to have a scenario where you want to access Application Context outside Activity or Fragment. One scenario is that if you are building an application that needs Multiple Language support and you want to access Strings from your ViewModels to show Localized strings for error / success messages. Traditionally in Android, the way to get access to Application Context was to hold a Static reference to it when the app launches and then use it later on. The way to achieve this is to inherit from Application in Android and hold your Static Application…

Read More

Troubleshooting NativeScript Android Setup Issues

By | Android, JavaScript, NativeScript, Telerik | One Comment

NativeScript is one of the most compelling open source cross-platform development frameworks for building truly native mobile apps. If you are new to NativeScript, native mobile app development in particular, or mobile app development in general, it is important to set up your development environment quickly and efficiently. As a developer, you will be very content with the experience that NativeScript provides to get your first hello world app up and running. All you have to do is to follow the instructions in the quick start guide. You would want to look at the Advanced Setup for OSX, Windows and Linux….

Read More
view-model-typescript-file

Case-sensitive File Naming for NativeScript TypeScript Source Files

By | Android, iOS, JavaScript, NativeScript, TypeScript | No Comments

When working with NativeScript it’s important to pay attention to the casing of filenames for your JavaScript source files, especially when working with TypeScript. When importing classes, interfaces, or other exported TypeScript items from other files, you must make sure that the letter casing in the reference matches the actual source file. More specifically, the letter casing of your reference needs to match the casing of the actual JavaScript (.js) files that will ultimately be loaded by the NativeScript runtime. After all, TypeScript ultimately gets compiled to JavaScript, and you want to make sure everything lines up! To demonstrate this,…

Read More

ListView with Switches in NativeScript Android

By | NativeScript | No Comments

Out of the box in NativeScript Android a list view’s item tap event will not fire if the list’s item template contains a Switch control, or any other actionable control for that matter.  The reason for this is that the other actionable controls in the item template take control of the click event.  In order to get around this you have to hook in to the actionable controls loaded event and set its “focusable” property to false.

To be fair the same issue occurs in native Android development, but the fix is much more straightforward.  You simply set…

Read More

Migrating from Mobile Services to Mobile Apps, when you should consider it

By | .NET, Android, Apps for Office, Azure, Microsoft, Mobile, News, node.js, Office365, Visual Studio, Web, Web & Mobile | 4 Comments

This is post 13 of 31 in the series “A Cloudy 29 Days of Microsoft Azure” In this column we are going to discuss the difference between Mobile Apps and Azure Mobile Services,. Azure Mobile Services allows you to add a cloud-hosted scalable backend to your connected apps within minutes. Whether you’re building apps for Windows 8, Windows Phone, iOS or Android you can take advantage of the Azure cloud to streamline your data and provide a robust, reliable and cost-effective platform to support your application. Mobile Services has been around since 2012 when it was in preview, and has seen many version updates and…

Read More

Cross Device Testing

By | Android, iOS, Mobile, SmartBear, TestComplete, Testing | One Comment

This is post 31 of 31 in the series “31 Days of Mobile Testing with TestComplete” Cross Device Testing For apps running on multiple devices and operating systems, you can avoid maintenance and extensibility headaches by planning up-front. I usually start by researching the expected work-flow. What are the objects? Are there methods and properties I need for automation? How different is the usability from one version of the app to another? Just a few simple actions can have a surprising number facets to consider. There’s no limit to how complicated things can get, on account of one thing always leading to another….

Read More

Testing Sensors on Mobile Devices with Test Complete

By | Android, iOS, Mobile, SmartBear, TestComplete, Testing | 2 Comments

This is post 30 of 31 in the series “31 Days of Mobile Testing with TestComplete” Sensors Sensors measure device position, movement and environment. TestComplete lets you enumerate and read each sensor. Both iOS and Android Device objects have an indexed Sensor property and a SensorsCount so you can iterate through the list. For example, to log every sensor name on a device:

  The log for my Samsung Galaxy shows the available sensors: To get the same for every connected device, iterate the Mobile object’s children using the ChildCount property and Child(index) method. The Child() method returns an…

Read More

Android Layout Background Color

By | Android, Mobile, SmartBear, TestComplete, Testing | One Comment

Android Layout Background Color – Bonus Post This isn’t part of the 31 days of TestComplete Mobile blog series, but is an answer to an interesting question that came up in the TestComplete forums: “Can I get the layout background color of an Android app? Layouts may not always have a solid background color, but when they do, here are two ways to get at it. If you have an instrumented app, you can use the native Android layout getBackground().getColor() methods. getColor() returns an integer that includes the alpha (amount of transparency) and the red/green/blue components of the color. I created…

Read More

Android Gestures

By | Android, Mobile, SmartBear, TestComplete, Testing | One Comment

This is post 24 of 31 in the series “31 Days of Mobile Testing with TestComplete” Android Gestures A big part of an app’s usability is in the user interaction: pinching gestures, rotation, two finger swipes and so on. Not to mention the ad-hoc gestures the app may experience in everyday handling of the device. Mobile applications can be crashed in new and innovative ways – just ask your average three-year-old to test your app, you might be surprised. TestComplete’s Gesture Collections let you record single and multiple simultaneous touch gestures. You can play them back at different speeds interactively,…

Read More

Responding to Android Toasts and Snackbars

By | Android, Mobile, SmartBear, TestComplete, Testing | 2 Comments

This is post 23 of 31 in the series “31 Days of Mobile Testing with TestComplete” Responding to Android Toasts and Snackbars Toasts and snackbars show status without getting in the way. Before Google introduced material design, toasts were the way to go. Toasts don’t receive focus, they don’t interrupt typing, but they aren’t easy to find with TestComplete. Toast behavior is by design. This works well for the end user, but can make testing a bear. You can wait for a toast with particular text, but TestComplete doesn’t give you a reference to the object (as of this writing). The screenshot…

Read More

Android Controls II

By | Android, Mobile, SmartBear, TestComplete, Testing | One Comment

This is post 22 of 31 in the series “31 Days of Mobile Testing with TestComplete” Android Controls II – ListView Scrolling, Finding Items Questions about Android ListView scrolling come up in the forums. The Extended properties have methods for touching and selecting items, but there’s nothing built-in for scrolling. For that you need native Java methods. The Android ListView smoothScrollToPosition() method moves to the top or bottom of the list:

Using the Orders sample that installs with TestComplete, there’s only seven items in the list — not enough to scroll with. Trying to scroll might constitute an error…

Read More

Android Controls I

By | Android, Mobile, News, SmartBear, TestComplete, Testing | 2 Comments

This is post 21 of 31 in the series “31 Days of Mobile Testing with TestComplete” Android Controls I — Supported Controls Looking at all the controls in Android Studio, I wouldn’t blame you for thinking it’s impossible to support them all. Here’s just a teeny piece of the design environment and palette of controls available to developers: I count 13 widgets for Text Fields alone. But all those edit widgets are represented in TestComplete by a single kind of control: EditText. The list of controls supported by TestComplete is documented here. You can get the list of what TestComplete has available right now in…

Read More

Android User Actions III

By | Android, Mobile, TestComplete, Testing | 2 Comments

This is post 20 of 31 in the series “31 Days of Mobile Testing with TestComplete” Android User Actions III – Dragging Dragging is like swiping except that the touch isn’t released after the user presses the screen and moves to a new location. Both the Device object and mobile objects (views, layouts, etc.) have their own Drag() methods:

Watch out for the last two parameters. Mobile objects use distances along the X and Y axis, but the device object uses an absolute ending X and Y coordinate. Using the device Drag() method, you can drag from the bottom…

Read More

Android User Actions II

By | Android, Mobile, SmartBear, TestComplete, Testing | 2 Comments

This is post 19 of 31 in the series “31 Days of Mobile Testing with TestComplete” Swiping and Getting Away with it The Device Swipe() method simulates a user flicking an object across the screen. Mobile objects don’t have their own swipe methods, so Device Swipe() uses starting and ending X and Y coordinates instead. Object Spy shows the parameter list in the description.

Read More

Android User Actions I

By | Android, Mobile, SmartBear, TestComplete, Testing | 3 Comments

This is post 18 of 31 in the series “31 Days of Mobile Testing with TestComplete” Android User Actions I – Touch and LongTouch You can get a lot of mileage calling Touch() and LongTouch() actions directly on Android controls. The script below automates the Driven Gallery app sample that installs with TestComplete. The script uses Touch() to select the “Tuesday” Layout object and LongTouch() to press an Android ImageView object. This second actions displays an Android toast with item information.

The log shows the initial state of the app on launching, after the Tuesday view is touched and after the ImageView…

Read More

Managing Android Packages

By | Android, JavaScript, Mobile, SmartBear, TestComplete, Testing | 2 Comments

This is post 17 of 31 in the series “31 Days of Mobile Testing with TestComplete” Find Packages on a Device Packages are the application archive files (*.apk) that download to your device when you install an app from Google Play. PackageManager keeps track of where app packages are stored on your device, and lets you remove, install and launch Android applications. If you installed packages from your desktop computer, PackageManager reports these locations as well. The code example below gets the latest package info and then rolls through the list using the manager’s InstalledPackagedCount and InstalledPackge properties. InstalledPackge returns a PackageObject that…

Read More

Instrumenting Android Apps III

By | Android, Mobile, SmartBear, TestComplete, Testing | 4 Comments

This is post 15 of 31 in the series “31 Days of Mobile Testing with TestComplete” Instrumenting Android Apps III You don’t have to pay special attention to certificates when you first instrument an Android app, but that doesn’t mean they aren’t part of the show. In fact, a debug certificate is generated automatically when TestComplete instruments an Android app. Certificates confirm that an application package comes from a specific developer. Trusted sites like Google Play and Amazon require that packages contain a digitally signed certificate before an app is accepted. To update that same app, the new package must…

Read More

Instrumenting Android Apps II

By | Android, Mobile, SmartBear, TestComplete, Testing | 3 Comments

This is post 14 of 31 in the series “31 Days of Mobile Testing with TestComplete” Instrumenting Android Apps II The TestedApps Instrument button is a handy way to prepare Android apps for testing, but not if there’s no one to press the button. To automate instrumentation, write script that adds a AndroidTestedApp to the TestedApps list automatically. This allows you to react to new builds or certificate changes without manual intervention. If you have an automated build process or continuous integration, TestComplete script can locate packages and certificates, then build instrumented packages on-the-fly. I have a simple Android app…

Read More

Instrumenting Android Apps I

By | Android, Mobile, SmartBear, TestComplete, Testing | 4 Comments

This is post 13 of 31 in the series “31 Days of Mobile Testing with TestComplete” Instrumenting Android Apps I You don’t need Eclipse or Android Studio to instrument your apps. The easy way is to configure a TestedApp and let TestComplete handle instrumenting. This works nicely if the app version doesn’t change often. Here are steps to instrument the sample Android Gallery app that installs with TestComplete: Right-click the TestedApps node and select Add > New Item. Select Android Application from the list. Add the path to the DrivenGallery.apk file. You can find DrivenGallery.apk in the TestComplete Samples directory. Leave the defaults and click the…

Read More

Open Apps Introduction

By | Android, iOS, Mobile, SmartBear, TestComplete, Testing | 3 Comments

This is post 12 of 31 in the series “31 Days of Mobile Testing with TestComplete” Open Apps Introduction Trying to test mobile apps using the “black-box” approach is like knocking on the door of a candy store with a sponge. You can see a few things from the window, but to get your hands on all that mobile-goodness, you have to open the door and step in. Image-based testing won’t show you an object’s properties and methods the way a desktop or web app will. The Object Browser shows the name of your iOS or Android device and that’s…

Read More

Using Mobile, Device and Desktop Objects

By | Android, iOS, Mobile, SmartBear, TestComplete, Testing | 2 Comments

This is post 11 of 31 in the series “31 Days of Mobile Testing with TestComplete” Using the Mobile Object The Mobile object is the starting point to reach connected mobile devices in TestComplete. In the Object Browser, Mobile is analogous to the Sys node. Instead of listing all processes, Mobile represents all devices connected. I have an iPhone and an Android device connected to a computer running TestComplete. They both show up in the Object Browser: List All Devices You can roll through all the devices using the Mobile ChildCount property and Child() method. The code is generic and doesn’t care…

Read More

Handling Image Variations

By | Android, SmartBear, TestComplete, Testing | 2 Comments

This is post 10 of 31 in the series “31 Days of Mobile Testing with TestComplete” In the last post we went down the happy path. We recognized a single image on a static background and called methods to touch the image. Your production apps are likely to have awkward combinations of resolutions, themes and image combinations. This blog will demonstrate techniques for handling image variations in image-based tests. Selecting an Image in the Preview Window Careful selection of the image up front will help avoid lots of issues. In the Image Set, you can drag the Preview image around until you see…

Read More