Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Android project utilizes https://junit.org/junit5/ and JUnit 5 for Android for performing unit testing and test automation. JUnit5 was chosen for its functionality and its clarity.

...

Jira Legacy
serverSystem JIRA
serverIde71e36b8-1c31-3d38-9c43-0d513e8b44c9
keyFNSDKEXT-122

Jira Legacy
serverSystem JIRA
serverIde71e36b8-1c31-3d38-9c43-0d513e8b44c9
keyFNSDKEXT-181

Jira Legacy
serverSystem JIRA
serverIde71e36b8-1c31-3d38-9c43-0d513e8b44c9
keyFNSDKEXT-182

Jira Legacy
serverSystem JIRA
serverIde71e36b8-1c31-3d38-9c43-0d513e8b44c9
keyFNSDKEXT-243

Usage

Implementing Tests

tl;dr https://www.lordcodes.com/articles/testing-on-android-using-junit-5

Existing Project

Basic usage of the existing testing project requires no special setup, as it was created as a JUnit5 test project in the first place; review the JUnit5 documentation for detail-in-depth.

Creating a New Project

If a new testing project needs to be created, here is a quick-and-dirty rundown:

  • Add the following block of code to the project build.gradle file, before the plugins { ... } block

    • Code Block
      languagegroovy
      buildscript {
          dependencies {
              classpath("de.mannodermaus.gradle.plugins:android-junit5:1.8.2.0")
          }
      }
      • Change 1.8.2.0 (plugin version number) as necessary.

  • Add the following line of code to the project build.gradle file, between the android { ... } and dependencies { ... } blocks:

    • apply plugin: 'de.mannodermaus.android-junit5'

  • Add the following block of code to the project build.gradle file, in the existing dependencies { ... } block (not the one in the buildscript scope, but the one that is its own scope, following the apply plugin line):

    • Code Block
      languagegroovy
      dependencies {
          testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.2"
          testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.2"
          testImplementation "org.junit.jupiter:junit-jupiter-params:5.3.2"
          
          // other dependencies...
      }

Executing Tests

To launch a test (or suite of tests):

  1. Open the SDK project in Android Studio.

  2. Navigate to the testing file that contains the test (or test suite) that you would like to execute.

  3. Click the green arrow beside the test (or test suite) that you want to run.

Note that the majority of tests require a connected Android device as well as a VictoR device that is available (i.e. at least one VictoR device that the Android device executing the test(s) can scan for and connect to).

...