UI Automator Test Framework

Interesting topics:

Lisp and Clojure

Cucumber and its android tool

Android Launcher app


CSCOPE; Source_insight

Maven: The Complete Reference; Maven by Example

How to Think Like a Computer Scientist(python)

Koans series(maven, ruby, javascript)

Android Developer Challenge

Git online learning

Architecture of salable website


GitHub Archive

GitHub Global Search

App Inventor


The Checker Framework


Go mobile


Interesting product and sites:



Conference and Journal 

Mobile Testing Tool




[TODO] 1. Dig the technical detail of bridging web code and native code? 2. What are the hardware acceleration of current devices? 3. Search the hybrid apps on other levels(wrappers, native UIs) (maybe using keywords “html” “mobile” etc.)


[bib] By studying user’s perception to animation and video, the study(The Impact of Cognitive Styles on Perceptual Distributed Multimedia Quality) suggests that the two QoS(Quality of Service) parameters do not impact user QoP(Quality of Perception), multimedia content and dynamism levels significantly influence the user understanding and enjoyment component of QoP

[TODO] 1. There are many existing techniques to improve the performance of HTML5.  But that also applies to web application. Is there any performance bottleneck unique to hybrid apps?


[TODO] 1. Why HTML5 is so different from last 4 versions? 2. Why interpreted code would be slower than compiled code? 3. What make UIWebViews are simply not robust enough to handle the needs presented in a rich application like Facebook? 4. How to improve the performance of HTML5?


[TODO] 1. Best practice of phonegap app (Or web app on Google IO), 2. Try open source and library app. 3. Scrape Google Play comment.(Analysis of user comments: an approach for software requirements evolution. ICSE13′)



Using traceview:

  • Lunch your app from eclipse in debugging mode.
  • Go to DDMS View
  • In devices window there is a small button called Start Method Profiling
  • Click it when you want ( you can combine it with break points to get accurate start/end)
  • when you’re done click Stop Method Profiling
  • A new window in DDMS will appear similer to traceview with the same output.

Performance Case Study



[Linux] Search command history:  shortcut of bash “Ctrl + R“, it can “search through previously used commands”


[Linux] Add path to linux: in directory /etc type: sudo vim profile; and then source profile; (source can enable the setting in command line temporarily; Restart to make profile effective)

[Linux] type “printenv” to get the environment variables (


./create /home/wyang/Projects/FirstPhoneGapProject com.youngwei.PhoneGapProject1 FirstPhoneGapProject

Don’t use “-” in project name or package ID


How to import the code of an existing open source project (using phonegap build) into a project that can use command build:

1. First create a new PhoneGap application. And override the assets/www directory with existing code:

$ /path/to/cordova-android/bin/ ./create /path/to/my_new_cordova_project com.example.cordova_project_name CordovaProjectName

2.  Build( For Debug):

/path/to/my_new_cordova_project/cordova/ ./build --debug

3. Run

/path/to/my_new_cordova_project/cordova/ ./run [Target] [Build]

where [Target] [Build] are optional parameters.

  • Target specification. This includes --emulator--device, or --target=<targetID>.
  • Build specification. This includes --debug--release, or --nobuild.


[Idea] Summarize the feature of each phone and create API mapping for equivalent functionality.


[Idea] The location of the code statement triggering collateral failure in the whole program structure will provide information for the fix.

[Idea] As described in this post, it’s very hard to automatically (or even manually) know the source of Intent to set up different data android:scheme.How to infer such information?

[Idea] Collateral failure is the simplest to detect. The work of finding oracle to help propagate other faults is essential.


[Latex] Remove binary files(.aux, .gz files etc.) from last built if you find wired compilation. errors. And then recompile. Something might be wrong in .bib file if you can compile the tex file before compiling bib file, but throw compilation error after compiling bib file.

[Idea] Testing HCI rather than GUI. Challenges/Tasks: 1. Modeling interaction; 2. Generate test cases.



Usability evaluation: task completion steps;Number of touches; Total navigation distance.



Initialize repository: git remote add [alias] [url]

Check the changes before commit: git status

Switch to a branch: git checkout [branch]

Merge a branch into current one: git merge [branch]

Final push:git push (-u) [alias] [branch]



sharing data between applications results in an unexpected loss of control of that data; Many research have been focused on the security part; But the security as a whole is about the unexpected functionality. We will carry out the study about whether intent and intent-filter pair would be sufficient to advertise or constrain the functionality.



A sequence is like a bit of genetic code. It helps things to unfold in the right way. An human embryo follows steps as it grows, and if it misses a step then there is a malformation. But ten embryos following the same sequence well leads to ten very different people, each one unique.

A sequence means a different process.

Normally what happens when you build a house, for example, is that an architect, tries more or less or understand what you want and makes a blueprint. But a blueprint and CAD designs are mostly guess work about what is going to be just right for the dimension of a room or the placement of a window. It’s like tossing thirty coins all at once and hoping they all land on heads. Never works. A sequence is figuring out which decision has to come first and getting it right and then moving to a second decision. Like tossing one coin at a time, which is actually a much better, faster, and less expensive way to get to thirty coins all on heads. But if you work from a blueprint you are stuck with your guesses and the builders, who aren’t the architect, just have to follow the blueprint, even when they know a much better solution. It’s a silly way to do things.

(My comment) Formal writing is more like blue print. Before we figure out the outline of a research project(Problem, technical challenges), we need to understand the sequence of things we should do on this project.

(Recurring iteration like Finding problem-> possible solution -> applied to more problems -> prune the solution)

( How developer develop inter-application communication -> What’s the common bugs -> How to detect those bugs -> How to fix those bugs -> How to prevent those bugs )


[Programming] A serialization bug. The package name and classname must be exactly the same at the both sides(Serialization and deserialization). Related post.


[Idea] We can use intent flag to assist the crawling and navigating.



  • Study the cooperation of the apps execution. How do I know an app will cooperate well with my own app? As “Activity A’s request (as defined in the intent) is honored over Activity B’s request (as defined in its manifest)”, the activity B will run in a different behavior than developer expected.
  •  test for navigation behaviors that might conflict with the user’s/developer’s expected behavior

[Idea] Study the responsiveness of Android application(How the life cycle(Intent flag) should be arranged to improve the responsiveness; How to keep the resource consumption of the background application to the minimum.)

[Android]If Activity A starts Activity B, Activity B can define in its manifest how it should associate with the current task (if at all) and Activity A can also request how Activity B should associate with current task. If both activities define how Activity B should associate with a task, then Activity A’s request (as defined in the intent) is honored over Activity B’s request (as defined in its manifest). So comparing the model that app running itself as the model when the app invoked by others is meaningless. Intent flag is an important factor that affect the application’s GUI model.

[Writing] {Definitions:

A task is a collection of activities that users interact with when performing a certain job. The activities are arranged in a stack (the “back stack”), in the order in which each activity is opened.

Filters advertise the capabilities of a component and delimit the intents it can handle

Activities in the stack are never rearranged, only pushed and popped from the stack—pushed onto the stack when started by the current activity and popped off when the user leaves it using the Back button. As such, the back stack operates as a “last in, first out” object structure.

A task is a cohesive unit that can move to the “background” when users begin a new task or go to the Home screen, via theHome button. While in the background, all the activities in the task are stopped, but the back stack for the task remains intact

One activity in your application might be instantiated multiple times (even from different tasks)


[Idea]{Can GUI model represent Precondition, postcondition, and abstract invariant checks? Correlation among AUT’s solo model, interactive model and Oracle app’s solo model, interactive model?

Filters advertise the capabilities of a component; Partially describe the Precondition

Flags can be the invariant of GUI model.

Model invariant: The activity state should remain the same when move from foreground to background and then move back.

Application specific invariant: Activity management(If the application sequence is A ->B ->C -> A; Questions on stackoverflow like that: 1, 2,3; “The most common errors/bugs in Android apps” from Quora);


[Idea]How to derive model based specification from task specification (StartActivityForResult(); OnActivity(); etc.)



[Android]Candidate AUT: Davike Explorer; Network Log; aLogcat(boundary); Call Meter 3G(boundary)

[Idea] Activity life cycle and thread life. Related post.

[Idea]Task driven UI testing. Post


[Android]PackageManager can help generate an intent to invoke another application(getLaunchIntentForPackage); But this method can only invoke the app as the app start itself, if we need to pass some parameter, we may still need implicit intent;

We can also use PackageManager to verify if the intent will be resolved on this phone(queryIntentActivities);

An intent can be use to turn applications into high-level libraries and make code re-use something even better than before.

,requestCode的作用是一个区别数据来源的标示符。比如A可以启动B, C, D三个Activity并期望从这三者得到数据,那么在用startActivityForResult()启动他们时,为他们分别分配一个独一无二的requestCode,然后在onActivityResult()方法中处理返回的数据时,就可以根据requestCode判断数据来源于B, C, D中的哪一个,进而进行不同的处理。


[Linux] Java directory for Ubuntu: /usr/lib/jvm

Set JavaHome: Need to verify this post

[Android] Resign the APK so that you can test it. (Android document about AppSigning; A tool; Robotium Document)

Import existing Android project code to Eclipse is troublesome. (If you don’t have build.xml and like Davik-Explorer)



How background application works? Syncing(For the sake of lesser data usag), loading etc…

Traditional Java library applied on Android Platform…

Platform migration and testing technique.

Multiple platform testing.

Using more resource on UI processing, which will save waiting time of the users. But how do you find this balance? Is there any best practice here?

Close unnecessary background process automatically.



Works fine on Emulator, but have error on real machine


Apps need multiple device interaction.


reproduce bug based on bug report.(其因为手机的多样性,系统的开放性导致bug很难repro,bug找之不尽)


The main difference from java program is that in integration testing. The integrate method—communication approach is different.


Testing: The controllability of Android program(provide the program with needed input) is poor.


May. 24th


Use “java -cp emma.jar emma report -r html -in coverage.em, -sp src/” to generate coverage report


The “adb pull” has different local location when used on command line or on mobile shell(adb shell).


遇到这个问题Error = Unable to find instrumentation info for……..可试试

adb shell pm list instrumentation 查看你的设备有没有安装这个instrumentation测试包,使用adb shell am instrument -w 必须要在设备上安装测试包


May. 25th

Main for astrid: com.todoroo.astrid.activity.TaskListActivity



    • getting the coverage report could not be any simpler:
      • create the ant script for building the test project. Open command prompt and go to your test project directory:
  • android update test-project -m <your_main_project_full_path> -p .
      • and run
  • ant coverage



More complete version should be:



In this example I expect that your test project is in a folder “tests” in your project folder which gets tested.

  1. Create a build.xml for your project (if it does not yet exist) cd <main project folder> android update project --path .
  2. Create the build.xml for the test project (that will allow us to do the coverage) android update test-project -m <full path to main project> -p tests/

Somehow “.” does not work and you have to use the full path like “/home/pboos/develop/workspace/project”

  1. Run coverage cd tests/ ant coverage



somehow, i always got error:


[exec] Failure in testRepeatingTaskUpgrade:

[exec] junit.framework.AssertionFailedError: expected:<2> but was:<0>

[exec] at com.todoroo.astrid.upgrade.Astrid2To3UpgradeTests.testRepeatingTaskUpgrade(

[exec] at java.lang.reflect.Method.invokeNative(Native Method)

[exec] at android.test.AndroidTestRunner.runTest(

[exec] at android.test.AndroidTestRunner.runTest(

[exec] at android.test.InstrumentationTestRunner.onStart(

[exec] at$


[exec] Error: Failed to generate emma coverage. Is emma jar on classpath?

[echo] Downloading coverage file into project directory…

[exec] remote object ‘/data/data/com.timsu.astrid/’ does not exist



/home/wyang/astrid/tests/build.xml:92: exec returned: 1


Not valid even after emma.jar in classpath(eclipse or $CLASSPATH). WILL try on my laptop again.





ant -diagnostics | grep home
To check the ANT_HOME




I comment the testRepeatingTaskUpgrade() test case in Astrid2To3UpgradeTests. in the package com.todoroo.astrid.upgrade.



May 30th.

Commandline error:


Buildfile: /home/david/workspace/astrid-tests/build.xml



[echo] Running tests …


[exec] com.todoroo.andlib.service.DependencyInjectionTests:…….

[exec] com.todoroo.andlib.sql.QueryTemplateHelperTest:………..

[exec] com.todoroo.andlib.test.SimpleAndroidTest:..

[exec] com.todoroo.andlib.test.TodorooTestCase:.

[exec] com.todoroo.andlib.utility.DateUtilitiesTest:….

[exec] com.todoroo.andlib.utility.TitleParserTest:………………….

[exec] com.todoroo.astrid.backup.BackupServiceTests:….

[exec] com.todoroo.astrid.dao.MetadataDaoTests:….

[exec] com.todoroo.astrid.dao.TaskDaoTests:……

[exec] com.todoroo.astrid.gtasks.GtasksDetailExposerTest:……

[exec] com.todoroo.astrid.gtasks.GtasksIndentActionTest:………..

[exec] com.todoroo.astrid.gtasks.GtasksMetadataServiceTest:………

[exec] com.todoroo.astrid.gtasks.GtasksTaskListUpdaterTest:……

[exec] com.todoroo.astrid.gtasks.GtasksTaskMovingTest:…………

[exec] com.todoroo.astrid.model.TaskTests:..

[exec] com.todoroo.astrid.provider.Astrid3ProviderTests:…….

[exec] com.todoroo.astrid.provider.ProviderTestUtilities:.

[exec] com.todoroo.astrid.reminders.NotificationTests:…..

[exec] com.todoroo.astrid.reminders.ReminderServiceTests:…….

[exec] com.todoroo.astrid.repeats.AdvancedRepeatTests:………

[exec] com.todoroo.astrid.repeats.NewRepeatTests:…………………………

[exec] com.todoroo.astrid.repeats.RepeatAfterCompleteTests:….

[exec] com.todoroo.astrid.service.ABTestingServiceTest:…….

[exec] com.todoroo.astrid.service.AstridDependencyInjectorTests:…

[exec] com.todoroo.astrid.service.QuickAddMarkupTest:…..

[exec] com.todoroo.astrid.service.UpdateMessageServiceTest:………..

[exec] com.todoroo.astrid.subtasks.SubtasksMovingTest:…..

[exec] com.todoroo.astrid.test.AstridTranslationTests:……

[exec] com.todoroo.astrid.test.DatabaseTestCase:.

[exec] com.todoroo.astrid.upgrade.Astrid2To3UpgradeTests:.

[exec] Error: Failed to generate emma coverage. Is emma jar on classpath?

[echo] Downloading coverage file into project directory…

[exec] remote object ‘/data/data/com.timsu.astrid/’ does not exist



/home/david/workspace/astrid-tests/build.xml:92: exec returned: 1


Total time: 4 minutes 17 seconds



May 31st

grep   string   /home/location   -r 

finally get coverage by email replied on github:

cd astrid

ant all clean

cd ../tests

ant clean emma debug install coverage

adb shell monkey -p com.timsu.astrid -v 500

To see the package name:

1. lauched the application, see the logcat, take the part before “/” as the packagename;

2. Menu > Settings > Applications > Running 


The emulator preserves the application and its state data across restarts, in a user-data disk partition. To ensure that the application runs properly as you update it, you may need to delete the emulator’s user-data partition. To do so, start the emulator with the -wipe-data option.



June 4th


Robotium is better compared to Monkey runner, cos Monkey runner needs objects based on location(x,y co-ordinates which may change as the application evolves) whereas Robotium  uses attributes of the object such as Text, index, image etc.



June 5th

adb shell am instrument -e coverage true -w


June 6th


./ -cp . -c net.mandaria.tippytipper.activities.TippyTipper -pt 10737 -g ./Demo/Demo.GUI -l ./Demo/Demo.log

new window(s) opened!!!


June 8th

use static analysis to provide more information:

onCreateOptionsMenu means there will be action triggered by MENU key.


Even the ID will be duplicate, we can still apply program analysis to see which onclickListener will be set in the application.



June 11th


Solve the problem of having space in path in shell script.

x=”test\ me”

eval cd $x

A combination of \ in a double-quoted text constant and an “eval” before “cd” makes it work like a charm!


More reference on eval:



June 12th

track setConentView and inflate to construct the widget hierarchy(Integration tree).

Information about Inflate:


June 14th

Some action like fling is constomized:

This situation is for


June 18th

Resource usage in the code Resource r = gerResources();


June 21st


jar cvf bundle.jar *


add all the files in a particular directory to an archive (overwriting contents if the archive already exists). Enumerating verbosely (with the “v” option)


To check the entry names in the jarfile, use the “t” option:

% jar tf bundle.jar


June 22nd

Linux系统最初就是不需要图形界面的,因为有一个很强大的文字界面。按 Ctrl-Alt-F1(F1-F6 一般来说都可以),然后等一会儿,就会切换到 tty,也就是所谓的文字界面。这个时候需要用用户名密码登入。注意,可能键盘输入的速度比较慢,不过应该还是可以忍受的。下面在提示符后面输入 top 回车,这时会看到一张动态的表,上面列出了耗用资源最多的进程。观察它刷新一两次,按q退出,然后输入 kill ,其中的 PID 你可以在 top 里面看到。这个时候应该会快了不少,如果你发现没有成功结束掉,就再输入 kill -KILL ,这次基本上就没问题了

Monkey may provide some basic functions to carry out actions like fling:


June 28th

Java 传参






O’Reilly’s Java in a Nutshell by David Flanagan (see Resources) puts it best: “Java manipulates objects ‘by reference,’ but it passes object references to methods ‘by value.'”




2、Java 应用程序有且仅有的一种参数传递机制,即按值传递


Junly 2nd

The equals() method of List,  returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).


July 9th

Java objects live on the heap, not the stack, and they are *never*

implicitly copied (except when they are serialized and sent over a network).


tringBuffer’s equals method returns true only when a StringBuffer 

object is compared with itself. It returns false when compared with any 

other StringBuffer, even if the two contain the same characters.

To compare the String objects that are produced by the StringBuffer 

objects in their current state, use s1.toString().equals(s2.toString()) 



July 19th


The head of this queue is the least element with respect to the specified ordering. 


Comparator compare(T o1, T o2)

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

July 23rd


How to enable computer keyboard through emulator:


July 24th



try { Thread.sleep ( 10000 ) ;

} catch (InterruptedException ie){}




July 26th

以下是 Android 的 View 物件中所包含的 EventListener


July 30th



August 2nd

Add code coverage to Android; running ant in eclipse

Set the argument “emma debug install test” in eclipse, you cannot run in command line because the dependence problem with robotium.


Sept 27th

Ant setting on windows

ad-hoc setting:

set ANT_HOME=c:\ant


set PATH=%PATH%;%ANT_HOME%\bin


export PATH=$PATH:/home

Spet 30th

Coverage.em is in bin directory 


Oct 1st


When seed number is larger than 1500


INSTRUMENTATION_RESULT: shortMsg=Process crashed.


two observations:

1. random testing cannot identify the action be performed, has very low rate of hitting the valid action, which may result in a high overhead.

2. random testing may fall into the GUI action loop like performed same action against ListView.

3. Differentiate content and software structure.

4. The widget in navigation bar will be exercised many times.