[android] #5610 - Adjusted public api after discussion [android] #5610 - added jni binding for NativeMapView#getLayer [android] #5610 - Added initial test Activity [android] #5610 - Started on NativePeer implementation for Layer [android] #5610 - replaced low-level jni code with high-level for native getLayer [android] 5610 - completed basic layer peer class - constructible from java and c++ [android] #5610 - removed reference that was redundant and causing the finalizer exception [android] #5610 - Added a property peer [android] #5610 - added value type to do type conversions - wip [android] #5610 - simplified property conversion approach - wrapped value with jenv [android] #5610 - added some more value conversions [android] #5610 - Finished conversion for basic types [android] #5610 - allow color's to be set as either an android color int or a String to support all formats in the spec [android] #5610 - encode color ints as rgba to retain alpha channel [android] #5610 - recalculate classes after paint property [android] #5610 - more examples [android] #5610 - fixed the example [android] #5610 - cleaned up example code before continueing [android] #5610 - added layout property example [android] #5610 - set visibility on layer [android] #5610 - added removeLayer and example [android] #5610 - added more type conversions [android] #5610 - Started on peer classes for layer implementations - WIP [android] #5610 - First complete layer subclass peer implementation [android] #5610 - added a little bit of structure before adding the other layer types [android] #5610 - generate the c++ headers from the style spec [android] #5610 - make sure the visibility is set as a string [android] #5610 - Generate c++ layer peer class implementations from the style spec [android] #5610 - generate java layer peer classes [android] #5610 - cleanup comments [android] #5610 - register all c++ peer classes with jni [android] #5610 - addLayer [android] #5610 - comment out broken case [android] #5610 - Sources api - very much WIP [android] 5610 - GeoJson source implementation and geojson conversion [android] #5610 - cleanup add source/layer example a bit [android] #5610 - initial filter api [android] #5610 - Added filter api on the relevant Layer classes [android] #5610 - raster layer is not filterable [android] #5610 - actually make it compile [android] #5610 - completed filter implementation [android] #5610 - Vector and Raster Source + examples [android] #5610 - removed superfluous interface, moved filters to the correct package [android] #5610 - fixed comments [android] #5610 - moved tests to the right package [android] #5610 - hide difference between paint and layout properties in public api, make more performant set method for proeprties [android] #5610 - fix rebase issue
Mapbox GL Test App
Testing
Running Espresso tests on a device
This test project comes with all the required Android Testing Support Library dependencies
in the Gradle file. Tests are under the app/src/androidTest folder.
Note that before running your tests, you might want to turn off animations on your test device. It's a known issue that leaving system animations turned on in a test device (window animation scale, transition animation scale, animator duration scale) might cause unexpected results, or may lead tests to fail.
To create a new run configuration:
- Click on Run -> Edit Configurations...
- Click on the plus sign and then on "Android Tests"
- Give a name to the configuration, e.g.
TestAppTests - Choose the
MapboxGLAndroidSDKTestAppmodule - Choose
android.support.test.runner.AndroidJUnitRunneras the instrumentation runner - Click OK to save the new configuration
You can now run this configuration from the main toolbar dropdown menu.
Running Espresso tests on AWS Device Farm
On a terminal, within mapbox-gl-native/android/java,
run the tests (cC stands for connectedCheck):
$ ./gradlew cC -p MapboxGLAndroidSDKTestApp
Then:
- Go to your AWS Console and choose Device Farm.
- Create a new project, e.g.
MapboxGLAndroidSDKTestApp - On step 1, upload the APK in
mapbox-gl-native/android/java/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-debug-unaligned.apk - On step 2, choose Instrumentation, test filter is
com.mapbox.mapboxgl.testapp.MainActivityTestand upload the APK inmapbox-gl-native/android/java/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-debug-androidTest-unaligned.apk - On step 3, choose a device pool. E.g. Top Devices
- On step 4, customize your device state (if needed)
- Finally, confirm the configuration and run the tests.
On Step 2, you can also separate by commas different classes: com.mapbox.mapboxgl.testapp.MainActivityTest,com.mapbox.mapboxgl.testapp.MainActivityScreenTest
If you have no tests for your app, or want to test some random user behavior, you can just choose "Built-in: Fuzz" in step 2.
Running pure JUnit tests
These tests run on a local JVM on your development machine and they are extremely fast to run
(as compared to Espresso). These tests are located under src/test/java. To run them you switch
to the Unit Tests build variant, then right click the corresponding test class or method
and select "Run ...".
You can also have a run configuration:
- Click on Run -> Edit Configurations...
- Click on "Junit Tests"
- Give a name to the configuration, e.g.
JUnit tests - As "Test Kind", choose "All in directory"
- As folder, choose the following folder:
mapbox-gl-native/android/java/MapboxGLAndroidSDKTestApp/src/test/java - Click OK to save the new configuration
You can also run the tests from the command line with:
$ ./gradlew test --continue -p MapboxGLAndroidSDKTestApp
Running the UI/Application Exerciser Monkey
Similar to the "Built-in: Fuzz" test mentioned above, Android provides Monkey, "a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events."
To exercise Monkey on the test app, install the package on the device (e.g. via Android Studio) and then:
$ adb shell monkey -p com.mapbox.mapboxgl.testapp -v 500