Git Product home page Git Product logo

a3e's Introduction

A3E

Automatic Android App Explorer (A3E) is an automated GUI testing utility for android applications. It is based on Troyd GUI testing framework. It provides two kinds of GUI exploration strategy, Depth-first Exploration and Targeted Exploration. To learn further, visit a3e homepage.

Publications

Requirements

Note: JDK 1.7 and greater is required. To get started, install Android SDK first and set paths to Android base tools, e.g., adb, aapt, etc. You can do so by adding the followings to your profile:

ANDROID_HOME=$HOME/sdk # your own path here!
export ANDROID_HOME

PATH=$ANDROID_HOME/tools:$PATH
PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH

The main scripts are written in Ruby and require RubyGems, a Ruby package manager, and Nokogiri, an XML library to manipulate manifest files. This tool is tested under Ruby 2.0 and Android 4.4.2.

Depth-first exploration

To run depth-first exploration use the command

$ ruby bin/rec.rb target.apk --no-rec -loop

This script starts an emulator (if no real device is connected), rebuilds Troyd, a controller app, resigns the app under test, installs both the controller and target apps on the emulator or real device; launches the app, and then starts ripping the application. It then sends valid commands to the app interface and explore the app in a depth-first fashion.

Targeted exploration

Coming.

Record and Replay

Feature enabled. Will update details soon.

Static Activity Transition Graph Creation

Modify the following parameter in the wala.properties file as per your system. For example in MacOS X this path may be something similar:

java_runtime_dir = /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre/lib

This is actually the path that contains the rt.jar or classes.jar file. This file contains the initial java classes that are loaded by the JVM when a java program runs.

After that, run

./apk2satg.sh your_apk.apk

The procedure may take several minutes depending on the size of the apk. The output will be two files,

your_apk.apk.g.xml: This xml file will contain the relation between parent and child activties. your_apk.apk.g.dot: This dot file is for visualization purpose.

A3E VM

To test a3e on your computer without needing to setup everything you can use this ubuntu 14.04 VM on virtual box. Make Sure you assign 2 GB RAM to the VM and enable 2D/3D acceleration for smooth use.

User Name: a3e Password: a3e_ucr

Open terminal cd into ~/a3e and run following command to test it with Amazon,

$ ruby bin/rec.rb aut/Amazon-33.apk --no-rec -loop

a3e's People

Contributors

hirajhil avatar tanzirul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

a3e's Issues

Depth exploration hangs in clicking

I have run this script "ruby bin/rec.rb target.apk --no-rec -loop" and meet this trouble.
The script is hanging without clicking. What's wrong with it?
screenshot from 2015-06-04 10 45 59

build failed on "build.xml"

Hi, the a3e world

I am a newer to a3e.
I run into a build failure when invoking the depth-first search on an example android app. 
It seems need to customize the "build.xml", can someone give me any instructions?

The log:
  • waiting for device -
    Buildfile: /Users/tingsu/Documents/Projects/a3e/troyd/build.xml

BUILD FAILED
/Users/tingsu/Documents/Projects/a3e/troyd/build.xml:83: Cannot find /Users/tanzirulazim/Dropbox/PhD/phd_data/tools/android_sdk/android-sdk-macosx/tools/ant/build.xml imported from /Users/tingsu/Documents/Projects/a3e/troyd/build.xml

Total time: 0 seconds
Buildfile: /Users/tingsu/Documents/Projects/a3e/troyd/build.xml

BUILD FAILED
/Users/tingsu/Documents/Projects/a3e/troyd/build.xml:83: Cannot find /Users/tanzirulazim/Dropbox/PhD/phd_data/tools/android_sdk/android-sdk-macosx/tools/ant/build.xml imported from /Users/tingsu/Documents/Projects/a3e/troyd/build.xml

Total time: 0 seconds
shell$ adb install /Users/tingsu/Documents/Projects/a3e/bin/../troyd/bin/troyd.apk
1153 KB/s (676113 bytes in 0.572s)
shell$ adb uninstall course.examples.UI.MenuExample
shell$ adb install course.examples.UI.MenuExample.resigned.apk
802 KB/s (46417 bytes in 0.056s)
shell$ adb shell am startservice -n umd.troyd/.Ignite -e AUT course.examples.UI.MenuExample.HelloAndroidWithMenuActivity

At last, the a3e tool hangs on the last command line.
Thanks in advance!

a3e is unable to install troyd.apk

Good morning,

I have encountered some problems during the execution of the tool.
More precisely, it is unable to install troyd.apk.
Even if I try to install that app manually using adb install troyd.apk, I get this error: Failure [INSTALL_FAILED_INVALID_APK]
Moreover, there is an exception before the attempt to install the app.
Could anyone help me?
Thanks in advance.

This is the output
out.txt

Passing widget texts in command arguments might cause issues

I observed this issue when the text contains special characters like spaces. To completely eliminate this problem, I modified both the app and cmd.rb to encode texts in Base64 when they are passed through command arguments.

--- a/bin/cmd.rb
+++ b/bin/cmd.rb
@@ -32,6 +32,7 @@
 module Commands
   CTRL = File.dirname(__FILE__)
 
+  require "base64"
   require "#{CTRL}/adb"
 
   def getViews
@@ -151,11 +152,11 @@ private
   end
 
   def w_idx_what(cmd, idx, what)
-    ADB.cmd(cmd, [["idx", idx], ["what", what]])
+    ADB.cmd(cmd, [["idx", idx], ["what", Base64.strict_encode64(what)]])
   end
 
   def w_what(cmd, what)
-    ADB.cmd(cmd, [["what", what]])
+    ADB.cmd(cmd, [["what", Base64.strict_encode64(what)]])
   end
 
   def w_idx(cmd, idx)
--- a/troyd/src/umd/troyd/Troy.java
+++ b/troyd/src/umd/troyd/Troy.java
@@ -54,6 +54,9 @@ import android.widget.ListView;
 import android.widget.ScrollView;
 import android.widget.TextView;
 
+import android.util.Base64;
+import java.nio.charset.Charset;
+
 public class Troy extends Instrumentation {
 
 	final static String tag = Troy.class.getPackage().getName();
@@ -152,7 +155,8 @@ public class Troy extends Instrumentation {
 		}
 
 		private String getWhat(Intent intent) {
-			return intent.getExtras().getString("what");
+			String what = intent.getExtras().getString("what");
+			return new String(Base64.decode(what, Base64.DEFAULT), Charset.forName("UTF-8"));
 		}
 
 		private int getIdx(Intent intent) {

run a3e occur some problems

I run tools by following commands:
E:\Android\tool\Test\a3e-master>ruby bin\rec.rb apks\Mileage.apk --no-rec -loop
Updated project.properties
Updated local.properties
Updated file E:\Android\tool\Test\a3e-master\bin..\troyd\proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
shell$ adb shell pm uninstall umd.troyd
系统找不到指定的路径。
系统找不到指定的路径。
shell$ adb install E:/Android/tool/Test/a3e-master/bin/../troyd/bin/troyd.apk
shell$ adb shell pm uninstall com.apps.mfcc
系统找不到指定的路径。
Traceback (most recent call last):
3: from bin/rec.rb:250:in <main>' 2: from E:/Android/tool/Test/a3e-master/bin/uid.rb:44:in change_uid'
1: from E:/Android/tool/Test/a3e-master/bin/uid.rb:44:in open' E:/Android/tool/Test/a3e-master/bin/uid.rb:44:in initialize': No such file or directory @ rb_sysopen - 1f813tj0/AndroidManifest.xml (Errno::ENOENT)

but there has something wrong, how can i solve this?

Temp folder missing

When trying to run the Depth First Search the "temp" folder in the project is missing causing a crash.

Testing hangs because of registering BroadcastReceiver on main activity

In Troyd app, registering BroadcastReceiver on main activity might cause A3E to hang if the main activity does not remain running throughout the test. To fix this issue, change the following line in Troy.java:

act.registerReceiver(r, new IntentFilter(Intent.ACTION_RUN));

to

getTargetContext().registerReceiver(r, new IntentFilter(Intent.ACTION_RUN));

Depth first search hangs

Depth first search hangs at the following step:

shell$ adb shell am startservice -n umd.troyd/.Ignite -e AUT <app and activity name>

I am on Mac OSX with the latest version of ruby, ruby gems, and nokogiri installed.

Targeted exploration

Dear Developer:
I have tried this tool, but I do not know: how to run Targeted exploration?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.