BLE GATT and NFC Support
You can use Mobile Center 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 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 Mobile API Virtualization Using SV Lab.
How Service Virtualization Simulation over BLE GATT and NFC Works
This section describes the hi-level workflow for learning or simulating a smart device connected to a mobile phone:
- Create a Mobile API agent that runs in Service Virtualization Designer or Server and enables the virtualization of mobile applications.
- Package the mobile application being tested using code that enables the virtualization of smart devices connected over BLE GATT or NFC devices.
- 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.
Testing Mobile Apps with BLE GATT or NFC
To test a mobile application for a device connected via BLE GATT or NFC:
Package and install the application under test.
- Locate the APK for the application under test.
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.
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:
MCAndroidEnabler.bat -custom sv-ble-net.json sv-ble.dex -signdebug myapp_v3.5.1.com.apk
MCAndroidEnabler.bat -custom sv-nfc-hce-net.json sv-nfc-hce.dex -signdebug myapp_v3.5.1.com.apk
Install the packaged APK on the Android phone in one of the following ways:
- Upload the packaged APK to Mobile Center 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
Connect the mobile phone to the Service Virtualization Designer.
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 Mobile Center and install it on a specific device through Mobile Center.
Install SV Connector using the ADB tool from the Android SDK. For example:
adb install sv-android-connector-4.0.apk
In Service Virtualization Designer, create and configure the Mobile API Agent. Note the assigned port for the next step.
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.
In the Service Virtualization Designer, create a new BLE GATT / NFC service using the Mobile API service protocol.
Learn and simulate as you would with any other protocol.