Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unit/integration tests for Bluetooth Low Energy Application
Forum Updated to NodeBB v4.3 + New Features

Unit/integration tests for Bluetooth Low Energy Application

Scheduled Pinned Locked Moved Unsolved General and Desktop
unit testbluetooth low e
1 Posts 1 Posters 259 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TUStudi
    wrote on last edited by
    #1

    Hi,

    I have developed a GUI Application for connecting to Bluetooth Low Energy devices and saving the data which comes from the sensor. Now I would like to create automated Unit tests (with QTest) to ensure that every unit works fine.

    So, e.g. I have a a class, which has the following functions, Signals for scanning for and connecting to Bluetooth Low Energy Devices (The following functions do not contain any code, it is only meant to be illustrative)

    
    void BluetoothModel::startDeviceDiscovery()
    {
        /*Available Sots: deviceDiscoveredSot  ,  deviceDiscoveryFinishedSlot*/
    }
    
    
    void BluetoothModel::deviceDiscoveredSlot(const QBluetoothDeviceInfo &device)
    {
        if(device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration)
        {
            emit deviceDiscoveredSignal(device);
        }
    }
    
    
    void BluetoothModel::deviceDiscoveryFinishedSot()
    {
            emit deviceDiscovereyFinished();
    }
    
    /*connects to device*/
    void BluetoothModel::connectToDevice(QBluetoothDeviceInfo device)
    {
        /*Available Slots: startServiceDiscoverySlot*/
    }
    
    
    void BluetoothModel::startServiceDiscoverySlot()
    {
        /*Available Sots: serviceDiscoveryFinishedSlot*/
    }
    
    
    void BluetoothModel::serviceDiscoveryFinishedSlot()
    {
        emit serviceDiscoveryFinishedSignal();
    }
    
    
    void BluetoothModel::startServiceDetailsDiscovery(QBluetoothUuid serviceUuid)
    {
        /*Available Sots: serviceDetailsDiscoveredSlot*/
    }
    
    
    void BluetoothModel::serviceDetailsDiscoveredSlot(QLowEnergyService::ServiceState newState)
    {
                emit characteristicDiscoveredSignal(characteristic);
    }
    
    

    The question now is, how can I divide these things into meaningful components? Should I see each function as a component or rather the whole class?
    My approach was e.g to test the scan function by starting it and expecting at least one device to be found. Another Unitests would be with the connect function, I test that the connected signal is triggered when the function is called with a . Is that the right approach? And how can I use the unit tests to test whether a signal is triggered?

    Another question: is it possible to make Integration tests with QTest´?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved