Wednesday, February 8, 2012

Native android application automation using bot-bot

Its been long time that I had written a blog here. I was busy with writing an android automation tool for native android application testing, named as "bot-bot". Please take a look at it and let us know your comments. This is work-in-progress and there are lot-of features that still have to implement.

Following are some of the links giving information on bot-bot:
Webpage:
http://imaginea.github.com/bot-bot/

Github page:
https://github.com/Imaginea/bot-bot

Most of the things are covered in the webpage or in Github.
In case of issues you can contact me or send a mail.

17 comments :

Anonymous said...

Appreciate your work, something that I was looking for.

Sireesha said...

Hi,
I installed bot-bot and tried to add it to an android app that we develop.But the application is getting crashed when it is trying to open the app.

App runs successfully when i just convert the app into AspectJ proj & run it.The above error is observed once i add recorder folder from the bot-bot source code to the root of the android project& run it.

Error logs says :
03-22 13:17:27.488: E/AndroidRuntime(27465): FATAL EXCEPTION: main
03-22 13:17:27.488: E/AndroidRuntime(27465): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hatchlabs.crowdfail/com.hatchlabs.crowdfail.screen.SplashScreen}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1816)
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1837)
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1033)
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.os.Handler.dispatchMessage(Handler.java:99)
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.os.Looper.loop(Looper.java:143)
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.app.ActivityThread.main(ActivityThread.java:4196)
03-22 13:17:27.488: E/AndroidRuntime(27465): at java.lang.reflect.Method.invokeNative(Native Method)
03-22 13:17:27.488: E/AndroidRuntime(27465): at java.lang.reflect.Method.invoke(Method.java:507)
03-22 13:17:27.488: E/AndroidRuntime(27465): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-22 13:17:27.488: E/AndroidRuntime(27465): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-22 13:17:27.488: E/AndroidRuntime(27465): at dalvik.system.NativeStart.main(Native Method)
03-22 13:17:27.488: E/AndroidRuntime(27465): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
03-22 13:17:27.488: E/AndroidRuntime(27465): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:198)
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.app.Activity.requestWindowFeature(Activity.java:2803)
03-22 13:17:27.488: E/AndroidRuntime(27465): at com.hatchlabs.crowdfail.screen.SplashScreen.onCreate(SplashScreen.java:63)
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
03-22 13:17:27.488: E/AndroidRuntime(27465): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1780)
03-22 13:17:27.488: E/AndroidRuntime(27465): ... 11 more

But when i tried with a sample android app it worked well.
we are using "requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);" in our project
which is custom button that we are placing in title bar of app.

Any suggestions to handle this?

Thanks,
Sireesha.

Varun Menon said...

@Sireesha - This is app related problem. It occurs with certain apps where certain part of the code needs to be executed before others. As bot-bot embeds its own code of recording before your app execution this issue is observed. We have tested bot-bot with few other apps and was not facing this issue. If you can share such an app with us, we will take a look at the said issue.

Unknown said...
This comment has been removed by the author.
Anonymous said...

hello ,
i used wordpress.apk by bot-bot
1. Install the apk from recorder folder
2. Start the server.
3. Open wordpress apk in androoid phone.
4. Aftersome time application has stopped unexpectedly.

Varun Menon said...

Hi @paras,

Does the app stop in idle condition or is it a particular use case in which it stops.
It will be good if you can send me the adb logcat when this issue happens.

Please use the following google group to ask your queries.
https://groups.google.com/group/bot-bot-users

Varun

vinod said...

hi i am trying to run my testcase but its showing junit.framework.AssertionFailedError:

junit.framework.AssertionFailedError
at junit.framework.Assert.fail(Assert.java:48)
at org.imaginea.botbot.keywords.BaseKeywordDefinitions.methodInvoker(Unknown Source)
at org.imaginea.botbot.keywords.BaseKeywordDefinitions.invoker(Unknown Source)
at org.imaginea.botbot.keywords.RobotiumKeywordDefinition.execute(Unknown Source)
at org.imaginea.botbot.keywords.KeywordCaller.execute(Unknown Source)
at org.imaginea.botbot.common.AndroFrameworkExecutor.execute(Unknown Source)
at org.imaginea.botbot.common.AndroFrameworkExecutor.androExecutor(Unknown Source)
at test.Simplecalc.testCalculatingTest(Unknown Source)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:115)
at junit.framework.TestResult.runProtected(TestResult.java:133)
at junit.framework.TestResult.run(TestResult.java:118)
at junit.framework.TestCase.run(TestCase.java:124)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1661)

can you please help me in solving this issue

Unknown said...

Hi,
I am using Bot-Bot but getting error when i type command ant server(server started well but it is giving error in build.XML file) while i have set ANDROID_HOME,ANT_HOME,JAVA_HOME And path for tools and platforms-tools as discussed in your getting started instruction.
D:\Anil\bot-bot-v0.82\bot-bot-v0.82>ant server
Buildfile: D:\Anil\bot-bot-v0.82\bot-bot-v0.82\build.xml
[taskdef] Could not load definitions from resource net/sf/antcontrib/antcontr
b.properties. It could not be found.
[taskdef] Could not load definitions from resource testngtasks. It could not
e found.
[taskdef] Could not load definitions from resource org/aspectj/tools/ant/task
efs/aspectjTaskdefs.properties. It could not be found.

server:
[java] [Winstone 2013/04/16 12:41:16] - Beginning extraction from war file

Varun Menon said...

Server should work fine, I dont think there will be any issues because of that.
Are you facing any problems?
You can post your problems in the bot-bot user group too.

Unknown said...

Server is working fine . I am able to see server on browser but there are no session and no record(local host is running)I am getting error when i type command ant server.I already have mentioned error above.
i want to test word press.apk first then i will try other apk but as you told in your getting started i will do same but giving error as above my post.

Varun Menon said...

if possible can you check adb logcat in your command prompt while trying to record and send the log.
Please use the following group to post your issues.

https://groups.google.com/forum/#!forum/bot-bot-users

Unknown said...

Hi varun,

i have installed bot-bot,ant and all other settings done.
successfully run bot server also
but 2nd step Integrate the recorder to the app,am stuck.

i executed the command ant recorder

and got error

runner\robo-build.xml:42: taskdef class com.android.ant.XPathTask cannot be found using the classloader AntClassLoader[]

please suggest me.

Unknown said...

Can you please reply to my above query,its urgent am stuck.

Unknown said...
This comment has been removed by a blog administrator.
Anonymous said...

run_convertor:
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Exception in thread "main" java.lang.IllegalArgumentException
[java] at org.objectweb.asm.ClassReader.(Unknown Source)
[java] at org.objectweb.asm.ClassReader.(Unknown Source)
[java] at org.objectweb.asm.ClassReader.(Unknown Source)
[java] at org.imaginea.botbot.Convertor.rewriteCode(Unknown Source)
[java] at org.imaginea.botbot.Convertor.main(Unknown Source)

Anonymous said...

I cant seem to run botbot, is this still being used or alive?
run_convertor:
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Adding method
[java] Exception in thread "main" java.lang.IllegalArgumentException
[java] at org.objectweb.asm.ClassReader.(Unknown Source)
[java] at org.objectweb.asm.ClassReader.(Unknown Source)
[java] at org.objectweb.asm.ClassReader.(Unknown Source)
[java] at org.imaginea.botbot.Convertor.rewriteCode(Unknown Source)
[java] at org.imaginea.botbot.Convertor.main(Unknown Source)

Varun Menon said...

Its currently not in active development. Have you tried Appium? Can you tell me if you are looking at specific features.

Post a Comment