tags:

views:

90

answers:

2

If u have downloaded any android source code u would see a test folder present for almost all applications and base framework. I wanted to know whether we build the test code too while building sdk from source code or is it just for our reference. If it is for the latter, what is the best way to use it. Please post me the exact use of tests present in android source code.

+1  A: 

The (unit)tests are probably there simply to make it possible for anyone extending the source to make sure the changes don't introduce unexpected behavior. It also sends the message that Google follows good software development practices and test their code and not just the end result.

All of the above said without having downloaded the source but just analyzed your description of what you see.

Edit: Of course, there is of course no point in removing the tests as they are equally open source. They could also help developers understand what the expected behavior is if the documentation isn't clear.

Fredrik
+1  A: 

The tests don't get automatically run when you run when you build the source. However, you can run them manually if you want.

If you want to do this, the commands should be:

build/envsetup.sh
emulator &
development/testrunner/runtest.py android

See this thread for a bit more information on this:
http://groups.google.com/group/android-platform/browse_thread/thread/a0eec9692f5072ba

Trevor Johns
I am getting some error while trying to run the script u have provided...can u give me some more clarity on how to run tests using the above code
Bharat Pawar
Unfortunately not without knowing what your error is.
Trevor Johns