You can send keystrokes and touch events with the MonkeyRunner API.
It's available in AOSP and Android 2.3, and documented in Android 2.3.

On Feb 1, 9:51 pm, Bharathi raja <[email protected]>
wrote:
> Hi,
>
> Can you please tell me it required any module\lib files to write python
> script to do keystrokes and touch event.
> if so, from where i will get those module files
>
> On Mon, Jan 31, 2011 at 10:45 PM, A. Elk 
> <[email protected]>wrote:
>
>
>
>
>
>
>
> > You might use Monkey to test that your app handles only certain
> > keystrokes, handles only keystrokes sent in a certain order, and
> > doesn't crash if it gets anything else. For touch events, you could
> > use it to test that random touches or gestures don't do something
> > unexpected in your application. As the Dev Guide topic says, Monkey is
> > for "stress-testing" your application.
>
> > MonkeyRunner provides limited scripting and control capabilities, so
> > that you can write Python scripts to run test suites. The Froyo Dev
> > Guide describes MonkeyRunner in some detail. You have to know Python
> > in order to use it. You can send keystrokes and touch events to
> > control the UI, but to send touch events you have to know the screen
> > coordinates where you want the touch to occur. That means that you'll
> > need to do some work by hand first, to figure out those coordinates.
> > As far as I know, MonkeyRunner can't do gestures.
>
> > Robotium is in Java only. It's like JUnit. You write something that
> > looks like a Java program. The Robotium runner interprets it as a
> > sequence of steps to run. There's documentation online; you should
> > Google "Robotium".
>
> > Suspend/restart could mean many things. You may or may not be able to
> > test those functions automatically. In general, you can't easily test
> > something that requires turning off the device.
>
> > File copying from the network could be done in MonkeyRunner. It really
> > depends on what you're trying to do. Since MonkeyRunner is essentially
> > a Python module, you can write any Python program you want and add
> > MonkeyRunner to it. Python can do just about anything you can think
> > of.
>
> > Python can accept user input.
>
> > Unfortunately, I don't have the time to teach you Python or Java. This
> > forum really isn't appropriate for that.
>
> > On Jan 31, 2:29 am, raki <[email protected]> wrote:
> > > Hi Alk,
>
> > > Thanks a lot for the reply.
> > > I had a look at Robotium. It seems it will solve my purpose.
>
> > > But I am still not clear on whats the difference between Monkey ad
> > > Monkey runner. Can u please give a simple scenario explaining thier
> > > main purpose and difference between each other?
>
> > > I would be grateful to you if you clarify the below questions as well?
>
> > > 1) To work with Robotium do I need to have knowledge on Java or can I
> > > manage with Python itself?
> > > 2) Power management processes like suspend/restart is a key part in
> > > our testing. Can I achieve it using Monkey runner or Robotium?
> > > 3) Can we automate the operations like file copy through network using
> > > Monkey runner/Python?
> > > 4) I would like to create scripts that accept inputs from user while
> > > running. I have no knowledge on Python. Hope I can achieve it in
> > > Python. Correct me if I am wrong.
>
> > > Thanks in advance.
>
> > > Rakesh
>
> > > On Jan 31, 2:40 am, "A. Elk" <[email protected]> wrote:
>
> > > > I don't think that Monkey will give you the type of UI testing you
> > > > want. It's mostly used to generate input while you test other things.
>
> > > > MonkeyRunner can do functional testing, but a better use for it is to
> > > > run suites of system tests and then collect the results. Remember,
> > > > too, that MonkeyRunner is an API, not a program; you have to write a
> > > > Python program to use it.
>
> > > > You may also want to look at Robotium, which is similar to Selenium
> > > > but with specific support for Android.
>
> > > > UI
>
> > > > On Jan 28, 12:06 am, raki <[email protected]> wrote:
>
> > > > > Hi,
>
> > > > > I want to automate UI and functional testing on Android OS.
>
> > > > > I am in dilemma whether to use Monkey or Mokeyrunner for the purpose.
>
> > > > > I will not be able to access the source code for the applications but
> > > > > I just need to test the applications, probably using Python/Shell
> > > > > scripting.
>
> > > > > Can anyone suggest me which tool I need to use for best results?
>
> > > > > I also want to include power management operations in between my UI
> > > > > testing processes.
>
> > > > > Any suggestions are greatly appreciated.
>
> > > > > Thanks,
> > > > > Rakesh
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%2Bunsubs 
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to