Monkey talk
-
Upload
faisal-sait -
Category
Documents
-
view
185 -
download
1
description
Transcript of Monkey talk
Monkey Talk for Android (Set Up) This will provide the details to set up of Monkey Talk for Android, to automate the application on Android.
You need to install MonkeyTalk Android Agent into the application which you want to automate. For this, please follow below steps:
1. Open your Android Project in Eclipse.
2. Right click on the project name and select Configure>>Convert to AspectJ Project.
3. Create “libs” folder in your Android Project and put MonkeyTalk-agent.jar in “libs” folder. MonkeyTalk-agent.jar
can be found in the "agents" folder in the MonkeyTalk package.
4. Right click on MonkeyTalk-agent.jar > AspectJ Tools > Add to Aspectpath.
5. Open AndroidManifest.xml and include the following two permissions:
o uses-permission android:name="android.permission.INTERNET"
o uses-permission android:name="android.permission.GET_TASKS"
6. Now RUN your application right click on the Project and Select Run As>>Android application.
7. You would see Android Emulator will appear and your application gets deployed on the emulator.
8. Launch MonkeyTalkIDE, which lies under “\win32.win32.x86\win32.win32.x86\MonkeyTalkIDE” folder.
9. Goto New>>MonkeyTalkProject, New Project window should appear. Provide project name and click in “Finish”
button.
10. Right-click on the project folder and select New > Test. Provide File name and click on “Finish” button.
11. Launch Android emulator and open your MonkeyTalk enabled application on the emulator.
12. Click on the connection dropdown button on the tool bar and select “Android Emulator/Tethered Device”.
13. If connection was successful, a message should appear in the console.
14. Click “Record” on the MonkeyTalk IDE.
Monkey Talk FAQs:
The FAQs are listed below,
General
1. How does it all work?
MonkeyTalk is a complete functional testing platform for mobile applications. Currently, it
supports testing native iOS and Android apps. The platform has three fundamental pieces:
the MonkeyTalk IDE, the MonkeyTalk Agent, and MonkeyTalk scripts.
MonkeyTalk IDE - desktop app for record/playback/creation of test scripts
MonkeyTalk Agent - library that must be added to app to enable testing
MonkeyTalk scripts - beautiful, understandable, maintainable test scripts
First, you must link the appropriate agent into your app (see the MonkeyTalk Agent for iOS
Installation Guide or the MonkeyTalk Agent for Android Installation Guide). Then you can use
the IDE to record and playback tests. Just follow the MonkeyTalk Getting Started and you'll
be testing in no time.
2. Does it run on real hardware or only in the Simulator/Emulator?
Yes. MonkeyTalk can test apps running on real hardware, and it can also test apps running in
the iOS Simulator or the Android Emulator. Furthermore, it can run on tethered devices and
untethered devices connected to the network.
3. Do I need to jailbreak or root my device?
Absolutely not. Testing an app with MonkeyTalk only requires the MonkeyTalk Agent to be
installed into the app under test.
4. Is it free?
Yes. MonkeyTalk is free to download and free to use.
5. Is it open source?
Yes. MonkeyTalk is licensed under the GNU Affero General Public License v3 (AGPL v3) open
source license. Additionally, we welcome contributions from the community in the form of
feedback and suggestions and especially patches.
The AGPL is basically identical to the GPL, but includes one very important additional
provision that requires releasing the source if you modify MonkeyTalk for use on the server.
The GPL permits making a modified version and letting the public access it on a server
without ever releasing its source code to the public. The AGPL closes this hole, such that
public use of a modified version, on a publicly accessible server, gives the public access to
the source code of the modified version. If you have any questions, read the AGPL v3 license
and talk to your lawyer.
6. Is it cross-platform? Can I record on iOS and playback on Android? Can I record on
Android and playback on iOS?
Yes. If you have logically identical apps on iOS and Android, you should be able to record
tests against one OS and play them back on another. Because MonkeyTalk records events at
the highest level, logically identical apps do not have to be visually identical for cross-
platform record and playback. For example, Android apps have typically have tabs on the
top of the screen and iOS apps have tabs on the bottom, but as long as they both have the
same tabs recording on either OS would record TabBar.Select, and playback on either OS
would work as intended.
7. Can I test an app without the source code?
No. You must install the MonkeyTalk Agent into the app under test during the build process,
which requires access to the app source code. But, once a MonkeyTalk-enabled build of the
app has been created (either by a developer, or by some continuous integration build job),
you can test it using MonkeyTalk without any access to the source code.
8. Can I test 3rd party apps (Camera, Browser, etc.)?
No. Testing an app with MonkeyTalk requires the MonkeyTalk Agent to be installed in the
app, which requires access to the app’s source code.
9. Can I test HTML5 web apps?
Yes, as of MonkeyTalk Beta5 we now support agents for iOS, Android, Flex, desktop web
browsers (Firefox only in Beta5), and mobile web. So you can test HTML5 apps in both a
desktop web browser and our bundled MTBrowser application.
10. Can I test desktop apps? Windows Phone 7? BlackBerry? Flex Mobile?
No, as of MonkeyTalk Beta5 we support agents for iOS, Android, Flex (but not Flex Mobile),
desktop web browsers (Firefox only in Beta5), and mobile web. That being said, we hope to
add more agents in the future.
11. Can I test mobile games?
It depends. Most games rely on random number generators, which makes reliable functional
testing difficult. In the future we may release a version of MonkeyTalk that overrides random
number generators and integrates with popular game engines, making testing more reliable.
You should still be able to test the non-random components of your game with MonkeyTalk if
you use standard UI components.
12. Can I test tablets or only phones?
Yes. MonkeyTalk can test apps running on all iOS devices (iPhone, iPad, iPod Touch) and
most (all?) Android devices. If you have an iOS or Android device that doesn't work with
MonkeyTalk, please let us know about it.
13. Can tests be fully automated? Can I run in CI? Can tests run outside the IDE? Can I
run tests from the commandline?
Yes. MonkeyTalk tests can be run either via Ant on the commandline (see MonkeyTalk Ant
for details) or via the Java Commandline Runner (see MonkeyTalk Runner for details). We
use Hudson/Jenkins as our CI server for running our internal tests and it works great. Most
fully automated tests use the Simulator/Emulator to run the app under test because it’s easy
to guarantee a repeatable starting state.
14. Can I publish a MonkeyTalk-enabled app into the store?
Maybe, but it’s definitely not recommended. Instead, we recommend you produce a
MonkeyTalk-enabled app (an app with the MonkeyTalk Agent installed) only as a developer
build.
15. Can I test embedded web pages (UIWebView on iOS, WebView on Android)?
Yes, as of MonkeyTalk Beta4 embedded WebViews can be tested via MonkeyTalk. In Beta5,
recording is not yet supported for components inside a WebView, but playback works great.
We expect to add recording to embedded WebViews in a future release.
IDE
1. How do I record a test?1. Open the IDE
2. Create a new test project (right-click > New > MonkeyTalk Project) if you haven’t already.
3. Create a new test script (right-click > New > Test)
4. Connect to the app
5. Click the record button
6. Use the app and watch recorded commands coming in...
2. How do I connect to the Emulator/Simulator?1. Open the IDE
2. Start up your Android or iOS emulator/simulator and load it with your MonkeyTalk enabled
app.
3. Click on the connection dropdown button on the tool bar (on initial start up it will be the
green android icon).
4. Choose "Android Emulator" or "iOS Simulator", depending on your platform of choice.
5. If connection was successful, a message to that effect should appear in the console.
3. How do I connect to a device?1. Open the IDE
2. Start up your Android or iOS device, load it with your MonkeyTalk enabled app, and let it
connect to your wireless network.
3. Click on the connection dropdown button on the tool bar (on initial start up it will be the
green android icon).
4. Choose "Networked Android or iOS device...".
5. Enter the IP address of the mobile device.
6. If connection was successful, a message to that effect should appear in the console.
4. I'm having device connection issues. Record doesn't work on a device. Help?
Connection issues are pretty common, so you're not alone. Here's a quick tip that everyone
should follow to help resolve connection issues to real devices:
The PC running the MonkeyTalk IDE and the device running the app under test MUST be on
the same wifi network.
This not really true, but unless you or your network engineer have a good understanding of
subnets, routers, NATing, etc. it is probably easiest to just be on the same wifi network. Also,
if you are having connectivity issues with devices, we recommend beginning your testing
adventures in the Simulator/Emulator as it is a little easier to get started and the odds of
connection issues are basically zero.
iOS Agent
1. What versions of iOS are supported?
The MonkeyTalk Agent for iOS requires iOS 4.0 or greater. If you have a version of iOS that
doesn’t work with MonkeyTalk, please let us know about it.
2. How do I install the MonkeyTalk Agent in my iOS app?
See the MonkeyTalk Agent for iOS Installation Guide.
3. Can I test on a tethered iOS device without Wi-Fi?
No. MonkeyTalk tests can only run over the network to real iOS devices, even if they are
tethered. If you are in a location without Wi-Fi, you can only test on the Simulator.
4. Do I need to put accessibilityLabel on all of my components?
No, but it is recommended. MonkeyTalk does it’s best to pick a understandable monkeyId
when recording, but it's even better to set it to a known value.
5. I'm seeing a crazy dyld: Library not loaded: /usr/lib/libc++abi.dylib error
trying to run on the Simulator 4.3. What gives?
Apparently there's a missing library. We recommend downloading libc++abi.dylib found
here and just copy it into /usr/lib.
6. Can I test iOS app on Windows PC?
Yes. You must use Mac hardware to develop the app and compile it the MonkeyTalk Agent
for iOS. But once that is done, you could use an over-the-air app distribution mechanism
(like TestFlight) to publish the app to any iOS device. And the the testers could run the
MonkeyTalk IDE on a Windows PC and connect to their iOS device over the network. Once
connected, they could record and playback tests as usual -- all from a Windows PC.
Android Agent
1. What versions of Android are supported?
The MonkeyTalk Agent for Android requires Android 2.2 (Froyo) or greater. If you have a
version or vendor flavor of Android that doesn't work with MonkeyTalk, please let us know
about it. New Android releases frequently include new UI components, and while we
endeavor to support recording and playback on all standard UI components, we sometimes
miss a few. So, please let us know about any stock components that don't work.
2. How do I install the MonkeyTalk Agent in my Android app?
See the MonkeyTalk Agent for Android Installation Guide.
3. Can I run MonkeyTalk tests against a debug version of the app under test? Why is
Android playback so slow?
Yes, it can be very useful to run MonkeyTalk tests with breakpoints in the app under test.
When running a debug version of the app under test in the Emulator, be aware that the app
can appear extremely slow in some cases (10+ seconds per command). Since the slowdown
appears to be Emulator and adb related, we highly recommend running on real hardware
4. Can I test on a tethered Android device?
Yes. Sometimes just unplugging and re-pluging a tethered device will help it connect. You
can not run tests on a tethered device while the Emulator is running or vice versa. Lastly, if
testing on a tethered device is an issue, testing works great on a un-tethered device over
the Wi-Fi network.
5. Do I need to put contentDescription on all of my components?
No, but it is recommended. MonkeyTalk does it's best to pick a understandable monkeyId
when recording, but it’s even better to set it to a known value.
6. I can't get the MonkeyTalk Android demo to work! What's wrong?
These are the steps you should follow to get the MonkeyTalk Android demo working
properly: 1) In Eclipse, File > Import... > choose Existing Projects into Workspace > Navigate
to the Android project demo1. 2) Right click on project > Properties > check Enable project
specific settings > pick Compiler compliance level: 1.6.
7. I am working with a tethered Android device and playback is working but I cannot
record. Why?
MonkeyTalk can playback over a USB tether but can only record over a network connection.
Make sure your device is connected to Wi-Fi and has TCP/IP connectivity to the IDE.
MonkeyTalk Scripts
1. What is the MonkeyTalk functional testing language?
MonkeyTalk is a powerful functional testing language. MonkeyTalk is keyword-driven -- you
can directly add new commands to the language. MonkeyTalk is data-driven -- any
command can be looped with CSV data file. MonkeyTalk is readable -- commands are
recorded at the highest level (tap a button, select a row from a table, check a checkbox).
MonkeyTalk is maintainable -- scripts are readable so it's easy to update them when the app
is updated.
2. Can I see a brief example of a MonkeyTalk script?
Here’s a simple login script (enter credentials then click the button):
Input username EnterText joe
Input password EnterText "my secret password"
Button LOGIN Tap
Next, here's a parametrized version of the same script:
Vars * Define usr pwd
Input username EnterText ${usr}
Input password EnterText ${pwd}
Button LOGIN Tap
Here’s how to invoke the parameterized login script from another script:
Script login.mt Run joe "my secret password"
For many more examples, see the MonkeyTalk Spec.
3. Do I have to use the MonkeyTalk IDE?
No. While the IDE contains many nice features for recording, playback, test debugging, test
creation, etc., it's not strictly necessary. You can easily create MonkeyTalk scripts in your
favorite text editor and play them back via the Ant runner or the Java runner. See
MonkeyTalk Ant Runner or MonkeyTalk Java Runner for details.
4. Can I convert MonkeyTalk test scripts into Javascript?
Yes. Furthermore, MonkeyTalk supports selective Javascript overrides at the individual script
level, so you can have most of your tests in MonkeyTalk and just those that demand a full
programming language in Javascript.
5. Can I see a brief Javascript example?
Here's the relevant Javascript for the simple login script from above:
app.input("username").enterText("joe");
app.input("password").enterText("my secret password");
app.button("LOGIN").tap();
6. What other language bindings does MonkeyTalk support?
Currently, MonkeyTalk test scripts can be converted to Javascript. No other language
bindings are supported.