Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8653633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:35:28+00:00 2026-06-12T14:35:28+00:00

I am planning to use monkeyrunner scripts to do automated test cases and I

  • 0

I am planning to use monkeyrunner scripts to do automated test cases and I want to use robotframework(I am not interested in robotium).
I saw an excellent tutorial for automating sikuli scripts with robotframework at
http://blog.mykhailo.com/2011/02/how-to-sikuli-and-robot-framework.html

Is there any way to do similar thing, with robotframework and monkeyrunner?

Here is my sample monkeyrunner script,this executes correctly when invoked with monkeyrunner.

from __future__ import with_statement
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

def testCase() :
    device = MonkeyRunner.waitForConnection()
    result2 = device.takeSnapshot()
    # Writes the screenshot to a file
    result2.writeToFile("scr.png","png")

def my_keyword():
    print 'Hello, world!'

if __name__ == '__main__':
    testCase()

I want to invoke the same with roboframework. and I am trying the following. I am not sure whether the following invocation is correct or not, I simply copied from sikuli automation example and modified it.

monkey_jar=/home/user/android-sdks/tools/lib/monkeyrunner.jar
guava_jar=/home/user/android-sdks/tools/lib/guavalib.jar
java -cp "robotframework-2.7.4.jar:$monkey_jar:$guava_jar" -Dpython.path="/home/user/android-sdks/tools/lib/" \
org.robotframework.RobotFramework --pythonpath=./  --outputdir=results --loglevel=TRACE $1

When I do this, I am getting the following error.

 Importing test library 'MyLibrary' failed: NoClassDefFoundError: Could not initialize class com.android.monkeyrunner.MonkeyDevice
java.lang.NoClassDefFoundError: 
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at MyLibrary$py.f$0(/home/user/automation/DemoScripts/MyLibrary.py:9)
    at MyLibrary$py.call_function(/home/user/automation/DemoScripts/MyLibrary.py)
    at robot.utils.importer$py._import$13(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/importer.py:154)
    at robot.utils.importer$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/importer.py)
    at robot.utils.importer$py.import_$28(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/importer.py:241)
    at robot.utils.importer$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/importer.py)
    at robot.utils.importer$py._import_class_or_module$4(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/importer.py:67)
    at robot.utils.importer$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/importer.py)
    at robot.utils.importer$py.import_class_or_module$3(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/importer.py:64)
    at robot.utils.importer$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/importer.py)
    at robot.run$py.main$3(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/run.py:367)
    at robot.run$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/run.py)
    at robot.utils.application$py._execute$10(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/application.py:87)
    at robot.utils.application$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/application.py)
    at robot.utils.application$py.execute_cli$5(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/application.py:45)
    at robot.utils.application$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/utils/application.py)
    at robot.run$py.run_cli$6(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/run.py:396)
    at robot.run$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/run.py)
    at robot.jarrunner$py._run$3(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/jarrunner.py:60)
    at robot.jarrunner$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/jarrunner.py)
    at robot.jarrunner$py.run$2(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/jarrunner.py:53)
    at robot.jarrunner$py.call_function(/Users/jmalinen/Documents/workspace/robot/tmp-jar-dir/Lib/robot/jarrunner.py)
    at org.robotframework.RobotFramework.run(RobotFramework.java:62)
    at org.robotframework.RobotFramework.main(RobotFramework.java:37)
PYTHONPATH:
  /home/user/automation/DemoScripts
  /home/user/automation/DemoScripts/robotframework-2.7.4.jar/Lib/robot/libraries
  /home/user/automation/DemoScripts/robotframework-2.7.4.jar/Lib
  /home/user/android-sdks/tools/lib/
  /home/user/automation/DemoScripts/Lib
  __classpath__
  __pyclasspath__/
  .
  /home/user/automation/DemoScripts
CLASSPATH:
  robotframework-2.7.4.jar
  /home/user/android-sdks/tools/lib/monkeyrunner.jar
  /home/user/android-sdks/tools/lib/guavalib.jar
==============================================================================

I believe that executing monkeyrunner test cases along with roboframework is quite possible.

Any inputs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:35:30+00:00Added an answer on June 12, 2026 at 2:35 pm

    Well, after trying for few days, I found that it is possible to use MonkeyRunner scripts with Robotframework.

    In short, you can use the folllowing to launch robotframework along with monkeyrunner.

    export cpath=$(echo libs/*.jar | tr ' ' ':')
    java   -Dpython.path=$cpath -jar robotframework-2.7.4.jar robo-tests.txt
    

    But only problem was, monkeyrunner’s main was not called, thus not initializing the ChimpChat object, which results in a null pointer exception. I fixed that in MonkeyRunner.java, and created a new monkeyrunner.jar. With this, I am able to run monkeyrunner scripts from roboframework. I will try to create a step by step tutorial and post it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am planning to use Jquery DataTable to display user inbox. I want to
We are planning to use SOAP UI Pro to test our Services (developed in
I am planning to use the PayPal Adaptive Payments API. I want to do
I am planning to use jquery in Rails instead of prototype. I am not
We are planning to use Visual Studio 2010 load test for doing stress test
Am planning to use cookies to communicate between two browser windows. Am wondering if
We are planning to use Team Foundation Server, but we need to decide whether
We are planning to use HTML 5 's Application cache in our application for
I am planning to use SCTP for a embedded Linux project. Anybody has some
I am planning to use Auto reset Event Handle for Inter Thread communication. EventWaitHandle

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.