- This MR add few basic tests for eDrive project. Those tests will be used as example for next tests by the maintainer of the project.
This is Integration/Unit test that run with Robolectric framework. Robolectric framework make a basic implementation of android framework which allow to run end-to-end test without devices or emulator.
Implemented test examples concerns:
Some tests interact with test's server (eeo.one), so credentials are provided at runtime.
There is also tiny changes to the normal class of eDrive to help making this tests to work:
- This merge request also update the Gitlab-ci process by splitting the build process in two part:
- Test as first part
- Build (without test) as second part
- Build.gradle have been updated to include required library and to make credentials available.
Test environment To run tests, there is two method:
- run tests from Android-studio's IDE
- run gradle task using gradle or gradlew from shell
If Java jdk 8 isn't the default jdk: For method 1:
- In Android studio, on eDrive project, open "build" menu
- select "edit flavors ..."
- in the new windows, click on "SDK Location"
- change "JDK Location" value
For method 2 :
-Dorg.gradle.java.home=/usr/lib/jvm/java-8-openjdk-amd64 to the command path.
The full command is then:
./gradlew test -Dorg.gradle.java.home=/usr/lib/jvm/java-8-openjdk-amd64
Your path to jdk 8 may be different than this one
In all case, for many tests that interact with server, you'll need account's credentials.
Some credentials are available on Gitlab by using CI's secret variable or your local environment
by creating a
local.properties file like below one at the root of the project:
sdk.dir=/home/vincent/Android/Sdk testAccountNamefirstname.lastname@example.org testAccountPwd=@nIncR€dibl€P@ssW0rD testServerUrl=https://foo.bar
This file must NOT be checked into Version Control Systems, as it contains information specific to your local configuration.
|Run test locally||All the test that doesn't contains expected failure should pass|
|check Gitlab's CI test result||you should have the same result for local test execution|
|Check that failed assertion's message are usefull||The message in case of failure must help to understand what fails|
## Expected result
Automatic execution of tests (without emulator/real device) before to build
nothing at the moment
Details of test result in Gitlab's pipeline
Test procedure explained
Tested on fresh install
Tested applied as an update