BLE GATT and NFC support

You can use UFT Mobile with Service Virtualization to simulate communication over BLE GATT or NFC between a mobile phone and a smart device (IoT), and virtualize smart devices and their service offerings.

BLE overview

BLE GATT is an acronym for Bluetooth Low Energy Generic Attribute Protocol. You can learn more here: https://www.bluetooth.com/specifications/gatt/generic-attributes-overview

NFC is an acronym for Near Field Communication. You can learn more here: https://nfc-forum.org/our-work/specifications-and-application-documents/specifications/specification-releases/

By learning and simulating a smart device's behavior, you can perform automated testing on mobile applications that are connected to smart devices. For example, you can simulate a smart coffee maker connected to a mobile phone, and test an application that controls the coffee maker's behavior.

While Service Virtualization can simulate some of the mobile API scenarios, for advanced cases involving data pushing and synchronization, use the SV Lab. For details, see SV Lab Concepts And Architecture Overview.

Back to top

Service Virtualization simulation over BLE GATT and NFC

Back to top

Workflow

This section describes the hi-level workflow for learning or simulating a smart device connected to a mobile phone:

  1. Create a Mobile API agent that runs in Service Virtualization Designer or Server and enables the virtualization of mobile applications.
  2. Package the mobile application being tested using code that enables the virtualization of smart devices connected over BLE GATT or NFC devices.
  3. Use the SV Connector application to configure the packaged mobile application, so that you can connect the application being tested to the Android BLE GATT / NFC Service Virtualization agent running in the Service Virtualization Designer or Server.

Back to top

Testing mobile apps with BLE GATT or NFC

To test a mobile application for a device connected via BLE GATT or NFC:

  1. Package and install the application under test.

    1. Locate the APK for the application under test.
    2. Get the ApkInfuser tool from the Microfocus AppDelivery Marketplace. Download the 'APKInfuser - Android app packager 2.53' package and extract the Zip file to the <Service Virtualization Designer installation directory>/Tools/AndroidTools folder.

    3. Navigate to the <Service Virtualization Designer installation directory>/Tools/AndroidTools folder and package the application using the APKInfuser tool. Use the following syntax, where <myapp...> is the name of the APK:

      For Bluetooth:

      MCAndroidEnabler.bat -custom sv-ble-net.json sv-ble.dex -signdebug myapp_v3.5.1.com.apk

      For NFC:

      MCAndroidEnabler.bat -custom sv-nfc-hce-net.json sv-nfc-hce.dex -signdebug myapp_v3.5.1.com.apk

    4. Install the packaged APK on the Android phone in one of the following ways:

      • Upload the packaged APK to UFT Mobile and install it on the mobile phone.
      • Install the packaged APK using the ADB tool from the Android SDK. For example:

        adb install myapp_v3.5.1.com.apk.signed.debug.apk

  2. Connect the mobile phone to the Service Virtualization Designer.

    1. Install the SV Connector application (also located in the <Service Virtualization Designer installation directory>/Tools/AndroidTools folder) on the phone in one of the following ways:

      • Upload the SV Connector to UFT Mobile and install it on a specific device through UFT Mobile.

      • Install SV Connector using the ADB tool from the Android SDK. For example:

      • adb install sv-android-connector-4.0.apk

    2. In Service Virtualization Designer, create and configure the Mobile API Agent. Note the assigned port for the next step.

    3. On the Android device, open the SV Connector application, set the Service Virtualization Server host name or IP address and the port of the Mobile API Agentcreated in the previous step.

      You can enable the connector debug log stored on the mobile phone in /sdcard/sv_event_log.txt. The log is recreated every time the application under test restarts.

  3. In the Service Virtualization Designer, create a new BLE GATT / NFC service using the Mobile API service protocol.

  4. Learn and simulate as you would with any other protocol.

Back to top