Updated readme with instructions for running tests. Fixed for Andoid-10
Updated the README with details of how to run the tests. Also added a minor fix to allow tests to run on pre-honeycomb devices. However their behaviour may not be 100% defined - because the contentproviders are not shuttind down correctly due to lack of an API to do so.
This commit is contained in:
parent
e7912359eb
commit
7c49f03f21
@ -16,11 +16,13 @@
|
||||
|
||||
package android.test;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.database.DatabaseUtils;
|
||||
import android.os.Build;
|
||||
import android.test.mock.MockContentResolver;
|
||||
import android.test.mock.MockContext;
|
||||
|
||||
@ -154,10 +156,18 @@ public abstract class ProviderTestCase2MockContext<T extends ContentProvider> ex
|
||||
*/
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
mProvider.shutdown();
|
||||
shutdownProvider();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
private void shutdownProvider() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mProvider.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the {@link MockContentResolver} created by this class during initialization. You
|
||||
* must use the methods of this resolver to access the provider under test.
|
||||
|
12
README.md
12
README.md
@ -56,6 +56,18 @@ would like to contribute.
|
||||
Running the test suite
|
||||
----------------------
|
||||
|
||||
In order to run the F-Droid test suite, you will need to have either a real device
|
||||
connected via `adb`, or an emulator running. Then, execute the following from the
|
||||
command line:
|
||||
|
||||
> `gradle connectedAndroidTest`
|
||||
|
||||
This will build and install F-Droid and the test apk, then execute the entire
|
||||
test suite on the device or emulator.
|
||||
|
||||
See the [Android Gradle user guide](http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Testing) for more details, including how to use Android Studio to run tests (which provides
|
||||
more useful feedback than the command line).
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
Loading…
x
Reference in New Issue
Block a user