Appium: iOS Testing with Node.js Step-by-Step Guide

Good day to everyone, in this tutorial, we will go through the process of writing node.js tests for iOS, from software installation to running actual tests on simulated devices with use of Appium.

Appium is a freely distributed open source framework for mobile application UI testing. Appium supports all languages that have Selenium client libraries like Java, Objective-C, JavaScript with node.js, PHP, Ruby, Python, C# etc.

Prerequisites to use Appium for iOS testing:

  1. OS X. I recommend using OS X Sierra (10.12 or higher). This is an essential requirement, since Appium cannot start sessions for iOS without Xcode, which is available only for Mac.
  2. JDK (Java Development Kit).
  3. Xcode. Get one either from AppStore or Apple Developer. By default, comes with iOS SDK, which we will need for running simulators.
  4. Homebrew – package manager for Mac. Will make our life easier in the long run.
  5. Appium Client for Mac (client).
  6. IDE and testing framework of choice. In our case, we will use js and mocha testing frameworks, so we need to install node.js at first. We will do so in the “Environment Setup” section below. NOTE: even though Appium client supplied with “Node.exe” and NPM (node package manager), we will install those manually to have the latest version.
  7. carthage – dependency for running XCUItests for iOS apps.

Environment Setup

Step 1. Download and install Xcode. Go to AppStore and type “xcode” in a search field. Grab the first one, provide your Apple ID if needed. After download is completed, go to the Applications folder and run Xcode to finish installation.

Step 2. Install Homebrew.

2.1. Open your terminal and run this command “/usr/bin/ruby –e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)“” (without outer quotes). Homebrew will start installation and ask for root password if needed. Just follow installation guidelines and you’ll be fine. For more details visit Homebrew site.

2.2. After installation run “brew doctor” (without quotes) to verify, that everything is okay.

2.3. Run a command “export PATH=”/usr/local/bin:$PATH”” (without outer quotes).

Step 3. Install node.js.

3.1. We will use Homebrew for this, so in terminal run a command “brew install node”. This will setup everything you need.

3.2. After installation, run commands “node –v” and “npm –v” to see installed version of node.js and npm respectively.

Step 4. Download and install JDK. After download is complete, navigate to your Downloads folder, double-click the downloaded .dmg file and follow installation instructions.

Step 5. Download and install Appium Client. Installation process doesn’t differ from the one described in Step 4.

Step 6. Install carthage. Simply run “brew install carthage” in the terminal.

Now, all of the required software is installed, let’s proceed with further setup.

Simulator setup.

In order to run our tests, we will need a device to run them on. For sake of this tutorial we will use iOS simulator, which is bundled with Xcode.

Step 1. Press Command + Space to launch Spotlight.

Step 2. Type Simulator and hit Enter.

Step 3. Launch a Simulator from search results

Step 4. When in Simulator, click the “Hardware” menu, then the “Device” “Manage Devices…”.

Step 5. In a Devices window you can view all available devices to you. Click the one you want to use for tests, let’s say “iPhone SE” with iOS version of 10.3.1.

Step 6. We will need info about the name, iOS, and Identifier to start both Appium Inspector session and our test execution. NOTE: if you need to run tests on device with iOS version not presented in list, you can create it by yourself.

6.1. Click the “+” button at bottom left corner of the window and choose the “Add Simulator”.

6.2. Set device name (it is mandatory to set unique device name), choose device type and iOS version. Download one you need if it is not presented in list.

6.3. Now you should see the newly created simulator in a list of simulators. Do not close this window yet as we will need it.

Step 7. Launch the Appium Client from your Applications folder.

Step 8. Type “localhost” (without quotes) in a Host field and click the “Start Server v.1.6.5” button. Now we have Appium Server up and running.

Step 9. Click the “Start Inspector Session” (button with magnifier on it). You should see this:

Step 10. Now, let’s specify details of simulator we want to use and app we want to install. Create the following set of Desired Capabilities:

Points to remember here:

  • app – full path to your built app on Mac. I’m using TestApp provided by Appium Team and available here. In case you want launch tests for Safari, omit this option and use “browserName”: “safari” NOTE: your app must be built specifically for simulator and testing purposes.
  • platformName – name of our platform. Since we want to run iOS tests, type iOS.
  • platformVersion – version of iOS on tested device. Look at “iOS” parameter of your simulator of choice on the “Devices” window and set it here.
  • deviceName – name of device you want to use. Grab the “Identifier” parameter of desired simulator on the “Devices” window and set it here.

Step 11. After that, switch back to your Simulator, go “Hardware” “Device” and choose a device type you want if your simulator isn’t already of that type. Wait for Simulator to restart and keep it running – this will decrease Appium Inspector startup time drastically.

Step 12. In Appium, click the “Start Session” button. You should see app being installed on your simulator of choice as good as Appium Inspector loading. NOTE: if you’ve encountered Appium error stating “could not get xcode version” you may want to set path to Xcode manually. In terminal, run commands “sudo xcode-select –reset” and sudo xcode-select –switch /Applications/Xcode.app (both without quotes). This should fix the issue. You should specify path to your Xcode.app according to your installation folder in case it differs from Applications. You should see something like this:

 

Writing tests

Now, we have everything set up. At this point, we can proceed with writing tests for our app using node.js.

Step 1. In Documents, create a new folder and name it “ios-node-test”. This will be our project folder.

Step 2. Open Terminal and navigate to your project folder using command “cd /full/path/to/your/folder” or start it in project folder directly.

Step 3. Execute the “npm init” command in the folder. Follow the setup process in a command line to configure package.json file of your project.

Step 4. After the basic setup, we need to add a bunch of dependencies in order to make our tests work. We will use mocha as our testing framework with chai for assertions. Also, we will require webdriverio testing utility, which improves interaction with mobile web, native and hybrid apps. So, run the following commands:

  • npm install mocha
  • npm install chai
  • npm install chai-as-promised
  • npm install wd
  • npm install wdio-mocha-framework –D (–D parameter here stands for installation this dependency only for developers)
  • npm install webdriverio@4.7.1 –D

NOTE: at the time of writing this guide the latest version of webdriverio is 4.8.0. However, we are installing v.4.7.1 due to setValue() method working incorrectly when using webdriverio v.4.8.0 in conjunction with Appium v1.6.5. Probably, fix for this issue will be included in future releases either from Appium or Webdriverio team.

Step 5. Create a subfolder and call it “helpers”. In “helpers” create file with .js extension and name in “desiredCapabilities”. In this file we will specify all the necessary details for our script, such as application we want to run and device we want to use for testing. Here is the completed content of the file, which follows our previous steps:

As you can see, in desiredCapabilities we haven’t change anything compare to Appium Inspector, although you may consider setting apps bundle id if you have one.

Step 6. Return to project folder and create a file “native.js”. This will be our script to run tests for native app. In order to locate elements, we will use accessibility id strategy, provided by webdriverio, for example:

.click(‘~IntegerA’)

This resource is specific to TestApp application, provided by Appium team as code sample. To get accessibility id of the element or any other identifier available we will use Appium Inspector. Just click the element while in the “Select” mod to properties panel to appear and grab the most suitable attribute or identifier. If by any means you cannot retrieve any selector except xpath you can use it as well, for example:

.click(//XCUIElement TypeButton[@name=”ComputeSumButton”])

 

Step 7. With that in place, we are ready to start scripting. As I said earlier, we will use webdriverio for writing our test, so consider looking at their docs for more info.

7.1. Let’s import all required components and create client – main object for interactions and actions:

var webdriverio = require(‘webdriverio’);

var expect = require(‘chai’).expect;

var config = require(‘./helpers/desiredCapabilities’).options;

var client = webdriverio.remote(config);

7.2. Now, create the main function by using describe keyword and pass “Simple cases” as the first parameter. This function will wrap our tests and declare before hook. This will be executed before our test-suite.

describe(‘Simple cases’, function () {

before(function () {

this.timeout(50000);

return client.init();

});

7.3. Create a sub-function by using describe keyword and call it “test-app-addition”. Set timeout for executing tests of this suite and write the tests with use of it keyword.

describe(“test-app-addition”, function(){

it(“add-3-3”, function(){

return client.element(‘~IntegerA’)

.setValue(“3”)

.element(‘~IntegerB’)

.setValue(“3”)

.click(‘~ComputeSumButton’)

.element(‘~Answer’)

.getText()

.then(function (text) {

expect(text).to.equal(‘6’);

});

});

});

7.4. In scope of wrapper function, add after hook, which will close the connection as well as the AUT.

after(function() {

return client.end();

});

});

Step 8. Open “package.json” and under scripts section add exactly the same line: “native”: “mocha native.js”. This will allow us to run our test by “npm run native”.

Step 9. Finally, your “ios-node-test” folder should be like this:

And “helpers” folder should be like this:

Step 10. Close your Appium inspector by hitting the “Quit Session & Close Inspector” button at the top-center panel.

Step 11. Run a script by executing “npm run native” in your project folder. You should see execution process on your device as good as mocha log in the console:

That’s it! Now you know how to install, setup and configure all required software to run your tests for iOS UI automated tests, as well as prepare environment for your tests. And, of course, you have a basic knowledge about writing tests themselves using node.js with webdriverio and mocha.

TestMatick company offers automation testing services for web and mobile applications. With TestMatick you can also utilize all the advantages of continuous integration. It includes setup of the environment which automatically integrates all parts of a project and executes tests every-time when someone makes a commit to the version control.

We provide QA automation services using the following automation tools:

– Selenium WebDriver
– Appium
– Automated QA TestComplete
– HP / Mercury QTP
– Segue SilkTest
– Ranorex
– Robotium

5 Major Challenges of Mobile App Testing

The increase in mobile phone usage is pretty evident nowadays. The smartphones are quickly becoming the primary tool of communication between consumers and businesses globally, giving birth to thousands of apps every day.

In other words, this phenomenal growth of mobile devices has opened up avenues for organizations to integrate them into the computing environment. Today’s mobile applications deliver complex functionality on platforms that have limited resources for computing. Diversity presents unique challenges that require unique testing strategies.

In comparison with web or desktop applications, mobile app testing is much more ambiguous. During this process, mobile app developers and app testers undergo various challenges.

Mobile apps have evolved at a much quicker rate than expected. They have made an unconquerable place in the lives of people that led to a significant increase in app usage. There is an upsurge in mobile app development services.

According to various statistics:

  • Mobile apps are expected to generate around the US $189 billion, by 2020.
  • The percentage of mobile users that are not happy with online user experience is 39%.
  • The percentage of users who do not return after getting poor experience is 46%.
  • Worldwide mobile app downloads are expected to rise up to 288 billion, by 2020.

The statistics mentioned above, highlight the importance of proper testing. The main motive is to provide better app performance and user experience. Nevertheless, there are a few challenges that an app tester must overcome, so he could develop better apps.

Here is the list of those major challenges.

  1. Creating a Better User Experience

A good user experience is fundamental for mobile apps success. There are various experts required for the mobile app development services. This comprises of developers, analysts, and designers.

After passing through various phases of development, the app lands up in quality assurance department to the tester. He inspects each and every aspect of the app development.

Nonetheless, the main challenge at this point in time is to have a clear understanding of target market, users, and relevant competitors. In order to conduct the test, these all things must be kept under consideration with brands value.

You have to be very careful while testing because the slightest negligence can result in poor UX. This can be overcome with extra research and good communication.

  1. Awareness about the Latest Innovations and Modifications

There is a genuine need for mobile app tester to stay updated with innovative and latest testing approaches. This begins with operations of mobile app and incorporates data testing with the environment.

Let keep this under consideration that mobile app functionalities modify in accordance with various data, sooner or later inviting a wholly new scenario for the testing process.

Apart from this, the evolving pitch of smartphones further makes the situation ambiguous. There is a critical need for a tester to stay updated with same things in accordance to modify the testing methods.

  1. Testing Automation

Testing automation is the most significant part of mobile app testing. There is the variety of tools available in the market to serve this purpose. Now it is the responsibility of the tester to identify and select which tool suits the best in executing the process.

This is determined by the operating system the application belongs to and the fact if it is paid or free. Let’s just think it this way, if you cannot find the best-suited tool to test the app, ask it from your own self; if it is paid or free. These are a few challenges that an app tester encounters while testing the app.

  1. Multi Device Testing

In this situation, you will require a testing laboratory set up accommodated with mobile devices. The tester will then check app performance on various devices.

This mobile app development service process might prove to be pricier in contrast to imitation technique as it confirms device based functions and other significant QoS strictures. On the contrary, fruitful execution will depend on the sudden variations in the platforms and the mobile devices.

In order to manage this again, it is important to stay updated with the latest trends of this industry. The tester is required to amalgamate those trends to conduct tests.

  1. Checking if The Network is Compatible

Network connectivity cannot be defined based on presuppositions. 3G or 4G connectivity does not always ensure a sound connectivity. There is also a probability that app users may be dependent on the 2G network.

Cross checking is required for mobile app tester to make sure that the app is working smoothly. In order to do this, mobile app tester has to make sure that he performs the test on all sorts of networks.

Conclusion

Mobile app testing comprehensively plays an imperative role in success and growth of any app. A little mistake and generate disastrous outcomes for your company. Here come the responsibilities of the client and development team to have a transparent communication. This should be combined with smart and hard work in order to deliver excellent results.

Author Bio:

Ray Parker is an entrepreneur and internet marketer with over 15 years of experience in Search Engine Optimization, Creative Writer and Digital Marketing with IQVIS. He has worked with several clients from all over the globe to offer his services in various domains with a proven track record of success.

The Best Automation Tools for Mobile Testing

There are many many automation tools available for Mobile Testing, that help release versions of mobile applications.

Appium:

Appium is an open source testing tool that automates native, hybrid, and mobile applications on both platforms, i.e. Android and iOS. Mobile or web applications are accessed using different browsers. It is a freely distributed open source mobile application UI testing framework.

Appium offers cross-platform application testing i.e. single API works for both Android and iOS platform test scripts.

Appium supports all languages that have Selenium client libraries like- Java, Objective-C, JavaScript with node.js, PHP, Ruby, Python, C# etc.

Robotium: 

Robotium is an open-source test framework for writing automatic gray-box testing cases for Android applications. It has complete control over hybrid and native applications. This testing tool makes it easier for users to document useful and rigid automatic black-box UI tests for Android mobile applications.

Through Robotium, mobile app developers can write system, function, and user acceptance test scenarios.

MonkeyTalk:

MonkeyTalk is a testing tool has been designed to automate the process of performing real functional interactive tests for Android and iOS mobile applications. The entire process ranges from standard smoke tests to complex data oriented tests.

Smoke testing is conducted to check whether the new framework added by the development team is highly stable or not. However, data-oriented tests involve the process of storing test data in some external space and utilizing the data while performing these tests.

Calabash:

Calabash is an automated acceptance testing tool for Android as well as iOS mobile applications. Calabash provides end-users with APIs that are customized to suit mobile applications. It can also be compared to Selenium WebDriver.

Google is trying to fix biggest problem with Android

Google is negotiating deals with chipmakers to help solve fragmentation, one of the biggest problems with Android, The Information reports. By working directly with chip partners, Google is looking to create hardware that will work seamlessly with Android, just as Apple products do with iOS.

The fragmentation of Android is a real issue for Google, phone markers, and users, who have to deal with outdated hardware, poor security, and a sub-standard experience. According to one estimate, there are over 18,700 distinct versions of Android compared to Apple’s five or six.

Google is seeking a more Apple-like approach, combining core functionality of the phone onto one chip. In the negotiations, Google asked chipmakers for a more sophisticated camera unit, improved on-board memory, and more power efficiency.

There could be a snag: The profit margins of Android handset makers, from Samsung to HTC, are already tightly squeezed and so the companies are more than willing to go with what works rather than what excels.

If Google manages to solve this conundrum, however, it could lead to an overall better Android experience for users that would place high-end Samsung, HTC, and Huawei devices in line with the iPhone.

Perforce Powers Development of Legacy Quest for iOS and Android

Socialspiel Meets Global, Multi-Platform Launch Timeline with the Perforce Helix SCM and Collaboration Platform

WOKINGHAM (UK), October 28, 2015Perforce Software today announced that Legacy Quest, the new free-to-play roguelike action-RPG game developed by Socialspiel Entertainment and published by Nexon, has launched in 14 countries. The game was developed using the Perforce Helix source code management (SCM) and collaboration platform.

Global Cross-Platform Development
The scalability of the Perforce Helix platform was critical to Socialspiel’s development process. The studio initially used Git for version control, but the platform couldn’t meet Socialspiel’s need to store all project assets—including large binary files—in one place. By using Perforce Helix as the “single source of truth” for all Legacy Quest IP, the studio’s art, audio and development teams from Germany and Korea collaborated seamlessly to branch, build and merge new releases across platforms including iOS and Android. Socialspiel estimates that Perforce Helix helped increase release efficiency by as much as 30 percent compared to previous projects.

“We founded Socialspiel as a group of ex-Rockstar Games and Deep Silver developers who were used to using Perforce on some of the largest game franchises in the world,” said Mike Borras, co-founder and CEO of Socialspiel Entertainment. “We thought that Perforce was out of our price range as a startup, but the free-for-20-users program allowed us to switch over from Git and continue working the way we’ve always done. From Legacy Quest’s initial development to its release and ongoing support, Perforce Helix allows us to operate at Triple-A scale, with the speed, flexibility and efficiency of a lean mobile studio.”

Perforce is the games industry’s most popular SCM and collaboration platform due to its speed, ease of use and ability to manage any type of file–including large binaries, such as the artwork and audio files used to make games. By acting as a single repository for all code, IP and other assets, it enables studios to accelerate many of their key development processes and easily plug in automation tools to quickly branch and manage builds.

Scaling Triple-A Development
Socialspiel started using Perforce Helix through the Perforce 20/20 Program, which offers Perforce Helix free of charge for up to 20 users or 20 workspaces; it also includes access to Perforce’s award-winning technical support. As Socialspiel outgrew the program, it migrated to the paid edition without any downtime or issues, allowing the studio to scale its Triple-A development practices throughout the entire development and release process.

“We created the 20/20 Program because we believe that companies shouldn’t have to compromise on the quality of their tools and processes based on their size and budget,” said Christopher Seiwald, founder and CEO of Perforce. “It’s very satisfying to work with young companies like Socialspiel and watch them grow and mature with our technology.”

Legacy Quest is available on iOS and Android. Additional press information on the game is available here:https://app.box.com/s/ztkcsw7s46lwot7r044sxsjflph8f958

About Perforce Software

Perforce Software helps companies build complex products more collaboratively and securely. Its highly scalable source code management (SCM) and collaboration platform, Perforce Helix, enables global teams to collaborate on any type or size of file. It supports both centralised and distributed (DVCS) workflows while safeguarding intellectual property with advanced behavioural analytics. Perforce is trusted by the world’s most innovative brands, including adidas, Samsung, NVIDIA, Intuit, Pixar, Salesforce, EA, Ubisoft and VMware. The company is headquartered in Alameda, California, with offices in the United Kingdom, Canada and Australia, and sales partners around the globe. For more information, please visit http://www.perforce.com/.

About Socialspiel Entertainment GmbH
Socialspiel Entertainment is a developer of free to play mobile games exclusively published by Nexon. Founded in 2010 in Vienna, Austria by a team of ex-Rockstar Games developers, Socialspiel has created several award winning free to play social games such as “Tight Lines Fishing” and “Asterix & Friends”. Since 2014, Socialspiel has been working together with Nexon to bring high-quality adventures to the hands of mobile gamers around the world. For more information, please visithttp://www.socialspiel.com.

Media Contacts

Global
Ivana Gaspic
Perforce Software
Ph: +1 510-473-3186
Mob: +1 415-955-7483
igaspic@perforce.com

US
Michael Thomas
Edelman
Ph: +1 312-233-1361
Mob: +1 773-822-6182
michael.thomas@edelman.com

UK/EMEA
Maxine Ambrose/Nicola Males
Ambrose Communications
Ph: +44 1491 412944
perforce@ambrosecomms.co.uk

Original Press Release @ realwire.com

Keynote Listed as “Representative Vendor” in Recent Gartner’s Market Guide for Mobile Application Testing

Keynote, the global leader in mobile testing and web performance management analytics, today announced that it has been included in the first-ever Gartner’s Market Guide for Mobile Application Testing which analyzes leading mobile functional testing and device management products.

According to Gartner, “The mobile market will reshape the landscape for testing.” Many of the world’s leading businesses at the forefront of this changing environment, such as Republic Services, Inc., have fueled Keynote’s growth by selecting Keynote Mobile Testing.

Keynote’s Mobile Testing solution is a cloud-based, enterprise-class SaaS solution that provides manual and automated testing for all mobile sites and native apps to ensure users experience high-performing, quality apps.

Keynote Customer Quote

“Technology is the key to helping the company achieve its goal.  We chose Keynote because of their technology capabilities and their support for us to test and rollout solutions rapidly that our customers actually want.” – Prashanth Sagiraju, QA Manager, IT, Republic Services, Inc.

Keynote Leadership Quotes

“At Keynote, we are committed to help businesses drive revenue by improving customer engagement across all digital channels. More digital transactions were conducted via mobile devices on Black Friday 2014 than by standard desktops for the first time ever. Our inclusion in Gartner’s Market Guide for Mobile Application Testing reflects our leadership and growth in mobile as the fastest growing segment within digital commerce. This wouldn’t be possible without the success of our customers who leverage our mobile cloud and testing products around the globe on a 24×7 basis for continual app releases that successfully support critical revenue streams.” –Jennifer Tejada, chief executive officer, Keynote.

“Amazing digital experiences are expected in mobile apps and more revenue than ever depends on them. We believe our inclusion underscores our ability to innovate ahead of alternatives with industry firsts such as wearable support or day one support of new OSs that ensure our customers’ success the first time they release their apps when they need it. With our continued innovations, our partners and customers can rest assured that their investment in Keynote is a sound one in a market that is evolving faster than any other in recent memory.” – Jonathan Rende, executive vice president of products and marketing, Keynote.

Gartner clients may access the full report on the Gartner website.

Join our social communities: Twitter, LinkedIn and Google+, YouTube.

1: Gartner “Market Guide for Mobile Application Testing” by Thomas Murphy and Joachim Herschmann, 3 December 2014.

Gartner Disclaimer

Gartner does not endorse any vendor, product or service depicted in its research publications, and does not advise technology users to select only those vendors with the highest ratings or other designation. Gartner research publications consist of the opinions of Gartner’s research organization and should not be construed as statements of fact. Gartner disclaims all warranties, expressed or implied, with respect to this research, including any warranties of merchantability or fitness for a particular purpose.

About Keynote

Keynote is the global leader in cloud–based testing, monitoring and analytics for mobile and web, optimizing the value of every digital interaction, enhancing user experience and driving business value through online performance. The company runs the world’s largest cloud testing, monitoring and analytics network in the world and collects over 700 million mobile and website performance measurements daily. In 2012 Keynote, a Thoma Bravo portfolio company, was recognized by Forbes Magazine as “One of the Best 100 Companies in America.”

Copyright © 2014 Keynote Systems, Inc. Keynote is a trademark of Keynote Systems, Inc. in the US and other countries. All other trademarks are the property of their respective owners.

Media Contact:

Celeste Malia

Keynote

Tel: +1.650.403 3251

E-mail: celeste.malia@keynote.com

 

SOURCE Keynote Systems, Inc.

The Latest Mobile Testing News department was not involved in the creation of this content.