mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-12 18:56:11 +08:00
![]() The preference creation actually needs to be before super.onCreate(savedInstance) in order to avoid the exception "requestFeature() must be called before adding content". Also ran into an issue in the native tests "Whitelist" and "User WebView/Client/Chrome" where it would throw an exception that the CordovaWebView appView already had a parent and needed to be removed from that parent before the invocation to root.addView(appView). So I conditionally remove the wrong parent. Also made a change to the native tests so the menus test would work. I also put super.init() back into the template, though invoking it is optional as loadUrl will call it automatically if needed. |
||
---|---|---|
.. | ||
assets/www | ||
cordova | ||
res | ||
src/org/apache/cordova | ||
.classpath | ||
.project | ||
AndroidManifest.xml | ||
ant.properties | ||
build.xml | ||
proguard.cfg | ||
project.properties | ||
README.md |
Android Native Tests
These tests are designed to verify Android native features and other Android specific features.
Initial Setup
There really isn't any manual setup to do. The ant script takes care of that. You don't even need to compile cordova-x.y.z.jar or copy it, because project.properties has a library reference to ../framework. However, Robotium has to be installed for the onScrollChanged tests to work correctly. It can be found at https://code.google.com/p/robotium/ and the jar should be put in the 'libs' directory'.
To run manually from command line:
- Build by entering
ant debug install
- Run tests by clicking on "CordovaTest" icon on device
To run from Eclipse:
- Import Android project into Eclipse
- Ensure Project properties "Java Build Path" includes the lib/cordova-x.y.z.jar
- Create run configuration if not already created
- Run As -> Android JUnit Test
Automatic Runs
Once you have installed the test, you can launch and run the tests automatically with the below command:
adb shell am instrument -w org.apache.cordova.test/android.test.InstrumentationTestRunner