featured image for perfomatix blog post - How to Conduct Mobile App Automation Testing Using MonkeyTalk Tool
App Development Hybrid mobile App development

How to Conduct Mobile App Automation Testing Using MonkeyTalk Tool?

MonkeyTalk is an open source mobile app automation testing tool for Android and iOS.

MonkeyTalk is a simple-to-use tool which automates real, functional interactive tests for iOS, Android, Web/HTML5, Hybrid and Flex apps.

This open source tool can be used for simple ‘smoke tests’ or for ‘data-driven test’ suites on native and hybrid apps, real devices or simulators.

Moreover, automation saves time, it is reusable and repeatable. MonkeyTalk is an open source automation tool.

It supports both Android and iOS platforms. It is very easy to learn and it’s a powerful functional testing tool.

Requirements to start testing with MonkeyTalk

  • Download and install Java
  • Download MonkeyTalk Pro
  • Need Eclipse or Android Studio to configure the source code

In order to record the script with MonkeyTalk, we need to configure the build with some dependencies.

The major component used for MonkeyTalk is the MonkeyTalkAgent.

Any build including Android or iOS need to be integrated with MonkeyTalk, otherwise, the tool cannot recognize the elements of the app. As a result, we cannot record or run the script on our test app.

The build which is integrated with MonkeyTalkAgent is called as Instrumented build.

Instrumentation can be done in 2 ways as follows:

  • MonkeyTalkPro provides an inbuilt feature to instrument the build, which injects MonkeyTalkAgent to the built.
  • Otherwise, we can manually integrate the MonkeyTalkAgent by configuring the source code using Eclipse or Android Studio before deploying the build.

Before we start configuring the source code, we need to install “AspectJ” plugin in eclipse.

Perfomatix Test Automation Services banner image

The procedures to install AspectJ plugin is available here. Once the plugin is installed, Now the open our project source code in eclipse.

Steps to Instrument the Android Build using Eclipse as Follows:

Step 1: Convert your Android project to AspectJ by right click the project name and select as follows.

Step 2: MonkeyTalk-agent.jar can be found in the “agents” folder in the MonkeyTalk package you downloaded earlier. The exact name of the jar might vary depending on the version, but it should always start with “MonkeyTalkagent”.

Step 3: Create a “libs” folder in your Android project, if you don’t already have one and Copy the monkeytalk-agent.jar into the libs folder.

Step 4: Right click on MonkeyTalk-agent.jar -> AspectJ Tools -> Add to Aspectpath.

Step 5: Update your AndroidManifest.xml to include the following two permissions:

Step 6: Update the project properties (right-click on the project -> Properties -> Java Build Path), select the Order and Export tab, and check the checkbox next to the AspectJ Runtime Library to export it:

Step 6: Deploy your application to an Android device or emulator.

As a result, you will find the instrumented .apk in project’s bin folder. By using that .apk, we now start the test with MonkeyTalkIDE. (For Video tutorial Click here)

Step to be followed to create a test in MonkeyTalk IDE is as follows:

Step 1: Create new TestProject by selecting (File -> New -> Project -> General -> Project). Enter the Project name (eg. MyProject) and click finish.

Step 2: Now add Test to the project by right click on the project and select (New -> Script). Enter the name for the test (MyTest) and select the project to which needs to be added. Now open the test file which we created (say “MyTest.mt”).

Step 3: Now we have to import the instrumented .apk which we already created, by selecting menu (App -> Select a .apk file to test) or select using toolbar as below:

Step 4: After adding the .apk, choose any of the connected device or emulators to test.

Once the device is selected the console below will show the message like this:

Step 5: Now install the .apk in the selected device as follows:

Step 6: Now launch the app in connected device as follows:

Note: Once again click on connect device, as a result the record and playback button will be enabled to start the test.

Step 7: Now we can start recording by click on the record button.

Whatever we work on the test app will be recorded by MonkeyTalk and generate the test script as follows:

Our test script can be view and edit in 3 ways as follows:

  • Table view
  • MonkeyTalk Script
  • JavaScript

Step 8: Once the recording is done. Click on Stop button and click Play button to view the playback of the script. (Before clicking on Play button, relaunching the application is recommended).

Step 9: To do a complete test on our test app, we have to add some verify commands if needed.

Step 10: Test result can be viewed in the console window.

Advantages of Monkeytalk:

  • Open source Tool
  • Provide Record and Playback
  • Support both Android and iOS
  • Support Cross platform recording
  • Easy Readable Test script
  • Support Gestures

Do You Need Expert Help?

If you need expert help with testing your newly developed Android or iOS app then you can count on Perfomatix.

We have use both manual and automation testing to ensure that the applications launched by our clients are bug-free and work flawlessly, as they are expected to be.

With our quality assurance services, you can dispel that risk of applications going awry in live environments.

Perfomatix | Product Engineering Services Company