Run multidevice NFC tests

To run multidevice NFC tests, prepare two devices with Android 15.

  1. Prepare two devices under test (DUTs) for the test:

    1. Connect the DUTs to a host machine over USB.
    2. Grant permissions for the host to access the DUTs over adb.
    3. Install the CTS Verifier app (CtsVerifier.apk) on the devices.:

      extract root/out/host/linux-x86/cts-verifier/
      cd android-cts-verifier
      adb install -r -g CtsVerifier.apk
    4. Install the required NFC test APKs:

      cd MultiDevice
      adb install -r -g NfcReaderTestApp.apk
      adb install -r -g NfcEmulatorTestApp.apk
  2. Set up NFC for the two DUTs:

    1. On both devices, go to Settings.
    2. Click NFC or Connected Devices.
    3. Ensure the NFC toggle switch is turned on.
    4. Hold the two devices close together, so that their NFC antennas are touching. The location of the antennas might be different for each device. You might need to use tape to keep the devices in place against unwanted vibration.
  3. Set up the environment:

    1. Install the Mobly test framework:

      pip install mobly

      If the command fails, try:

      pip install mobly --user --break-system-packages

      For more details about Mobly setup, refer to Welcome to Mobly.

    2. Set up the test environment:

      cd MultiDevice
      source build/

      This command checks the Python and Mobly installation and sets up the PYTHONPATH environment variable. If no errors are printed to the terminal, the environment is ready to run the multidevice tests.

      If you see the error message no version information available (required by /bin/sh) at runtime, run the following command to rename the file:

      mv $ENV_DIRECTORY/lib/ $ENV_DIRECTORY/lib/
    3. Set up the test bed by setting the device serial IDs of the DUTs in the MultiDevice/config.yml:

      - Name: cts_nfc_hce_multi_device_test
          - serial: "<device-id>"
          - serial: "<device-id>"
  4. Run the tests:

    1. Open the CTS-V app and click NFC Tests:

      The CTS-V app

      Figure 1. The CTS-V app.

      The info window with list of test cases appears:

      The CTS-V app test cases

      Figure 2. CTS-V app test cases.

    2. Run the tests on your host:

      MultiDevice$ python3 tools/

      When the tests are completed, the test results are updated in the CTS-V app. Successful tests are green:

      The CTS-V test results

      Figure 3. CTS-V test results.

    3. If you see any failures marked in red, run the tests again.