Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

Instrumentation test oreo

Vincent Bourgmayer requested to merge instrumentation-test-oreo into v1-oreo

Description

  1. 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:

  • ObserverService.java
  • InitializerService.java
  • OperationManagerService.java
  • UploadFileOperation.java

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:

  • CommonUtils.java
  1. 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

The test job makes test's result to be visible in a pipelin's details under the "Tests" tabs image

  1. Build.gradle have been updated to include required library and to make credentials available.

Issue(s)

Test procedures

Test environment To run tests, there is two method:

  1. run tests from Android-studio's IDE
  2. run gradle task using gradle or gradlew from shell e.g: ./gradlew test

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 : Add -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
testAccountName=dummy@foo.bar
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.

Steps

Action  Expected result
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

Technical details

nothing at the moment

Screenshots

Details of test result in Gitlab's pipeline

image

Check list

  • Self review
  • Test procedure explained
  • Tested on fresh install
  • Tested applied as an update
  • License
  • Internal documentation
  • User documentation
Edited by Vincent Bourgmayer

Merge request reports

Loading