From: DoHyun Pyun Date: Mon, 2 Nov 2020 00:05:45 +0000 (+0900) Subject: [Bluetooth][Manual][Non-ACR] Make combine TC for LE Device X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F246468%2F8;p=test%2Ftct%2Fcsharp%2Fapi.git [Bluetooth][Manual][Non-ACR] Make combine TC for LE Device To reduce the time consuming for verifying BT C# Manual TCT, we classify testcases using same senario. And remove the duplicate execution. Change-Id: I1d3367b7b906acc9e0f12108203b78549e4e6d2b Signed-off-by: DoHyun Pyun --- diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSAdapterLeScanResultChangedEventArgs.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSAdapterLeScanResultChangedEventArgs.cs deleted file mode 100644 index 9bf97d1..0000000 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSAdapterLeScanResultChangedEventArgs.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System.Threading.Tasks; -using BluetoothNetworkUtils; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Xamarin.Forms; -using Tizen.System; -using System; - -namespace Tizen.Network.Bluetooth.Tests -{ - [TestFixture] - [Description("AdapterLeScanResultChangedEventArgs Tests")] - public class AdapterLeScanResultChangedEventArgsTests - { - static BluetoothLeDevice leDevice = null; - static bool isBluetoothLeSupported = false; - - [SetUp] - public static void Init() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le", out isBluetoothLeSupported); - } - [TearDown] - public static void Destroy() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Test Result. Check the Result value")] - [Property("SPEC", "Tizen.Network.Bluetooth.AdapterLeScanResultChangedEventArgs.Result A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static async Task Result_PROPERTY_READ_ONLY() - { - try - { - EventHandler scanDeviceResultEventHandler = null; - - scanDeviceResultEventHandler = (sender, e) => { - BluetoothAdapter.StopLeScan(); - Task.Delay(1000).Wait(); - - Assert.IsTrue((int)e.Result == 0, "[TestCase][Result_PROPERTY_READ_ONLY] Failed"); - BluetoothHelper.DisplayPassLabel("Result_PROPERTY_READ_ONLY"); - }; - - BluetoothAdapter.ScanResultChanged += scanDeviceResultEventHandler; - - BluetoothAdapter.StartLeScan(); - - await ManualTest.WaitForConfirm(); - - BluetoothAdapter.ScanResultChanged -= scanDeviceResultEventHandler; - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test DeviceData. Check the DeviceData value")] - [Property("SPEC", "Tizen.Network.Bluetooth.AdapterLeScanResultChangedEventArgs.DeviceData A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static async Task DeviceData_PROPERTY_READ_ONLY() - { - try - { - EventHandler scanDeviceResultEventHandler = null; - - scanDeviceResultEventHandler = (sender, e) => { - BluetoothAdapter.StopLeScan(); - Task.Delay(1000).Wait(); - - Assert.IsNotNull(e.DeviceData, "[TestCase][DeviceData_PROPERTY_READ_ONLY] Failed"); - Assert.IsInstanceOf(e.DeviceData, "[TestCase][DeviceData_PROPERTY_READ_ONLY] Failed"); - - BluetoothHelper.DisplayPassLabel("DeviceData_PROPERTY_READ_ONLY"); - }; - - BluetoothAdapter.ScanResultChanged += scanDeviceResultEventHandler; - - BluetoothAdapter.StartLeScan(); - - await ManualTest.WaitForConfirm(); - - BluetoothAdapter.ScanResultChanged -= scanDeviceResultEventHandler; - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("DeviceData_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("DeviceData_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - } -} diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine2_LeDevice.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine2_LeDevice.cs new file mode 100644 index 0000000..1ffc1ed --- /dev/null +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine2_LeDevice.cs @@ -0,0 +1,1088 @@ +using System; +using System.Threading.Tasks; +using BluetoothNetworkUtils; +using System.Linq; +using System.Collections.Generic; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.System; +using Xamarin.Forms; + +namespace Tizen.Network.Bluetooth.Tests +{ + [TestFixture] + [Description("BluetoothLeDevice Tests")] + public class BluetoothLeDeviceTests + { + bool isBluetoothLeSupported = false; + bool isBluetoothGattClientSupported = false; + + BluetoothLeDevice leDevice = null; + bool scanFlag = false; + bool isGattConnected = false; + string remote_ble_addr = PreconditionUtils.GetBleAddress(); + string default_remote_addr = PreconditionUtils.GetDefaultAddress(); + BluetoothGattClient client = null; + + /* PASS flag Variaibles for TCs */ + static bool pass_Result_PROPERTY_READ_ONLY = false; + static bool pass_DeviceData_PROPERTY_READ_ONLY = false; + static bool pass_AddressType_PROPERTY_READ_ONLY = false; + static bool pass_AdvertsingDataInformation_PROPERTY_READ_ONLY = false; + static bool pass_Appearance_PROPERTY_READ_ONLY = false; + static bool pass_DeviceName_PROPERTY_READ_ONLY = false; + static bool pass_ManufacturerData_PROPERTY_READ_ONLY = false; + static bool pass_RemoteAddress_PROPERTY_READ_ONLY = false; + static bool pass_Rssi_PROPERTY_READ_ONLY = false; + static bool pass_ScanDataInformation_PROPERTY_READ_ONLY = false; + static bool pass_ServiceSolictationUuid_PROPERTY_READ_ONLY = false; + static bool pass_ServiceUuid_PROPERTY_READ_ONLY = false; + static bool pass_TxPowerLevel_PROPERTY_READ_ONLY = false; + static bool pass_GetServiceDataList_RETURN_LIST = false; + static bool pass_PacketType_PROPERTY_READ_WRITE = false; + static bool pass_GattConnect_RETURN_VALUE = false; + static bool pass_GattDisconnect_RETURN_VALUE = false; + static bool pass_GattConnectionStateChanged_CHECK_EVENT = false; + static bool pass_GetAppearance_RETURN_VALUE = false; + static bool pass_GetDeviceName_RETURN_VALUE = false; + static bool pass_GetManufacturerData_RETURN_VALUE = false; + static bool pass_GetServiceSolicitationUuid_RETURN_VALUE = false; + static bool pass_GetServiceUuid_RETURN_VALUE = false; + static bool pass_GetTxPowerLevel_RETURN_VALUE = false; + static bool pass_GetServiceDataList_RETURN_VALUE = false; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le", out isBluetoothLeSupported); + Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le.gatt.client", out isBluetoothGattClientSupported); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); + } + + public async Task WaitScanFlag() + { + LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "Inside waitScanFlag"); + int count = 0; + while (true) + { + if (scanFlag == true) + break; + + await Task.Delay (1000); + count++; + if (count == 20) + break; + } + } + + public void scanResultEventHandler(object sender, AdapterLeScanResultChangedEventArgs e) + { + if (e.DeviceData != null && leDevice == null) + { + /* PASS condition for Result_PROPERTY_READ_ONLY */ + if (pass_Result_PROPERTY_READ_ONLY == false) + { + Assert.IsTrue((int)e.Result == 0, "[TestCase][Result_PROPERTY_READ_ONLY] Failed"); + pass_Result_PROPERTY_READ_ONLY = true; + } + + /* PASS condition for DeviceData_PROPERTY_READ_ONLY */ + if (pass_DeviceData_PROPERTY_READ_ONLY == false) + { + Assert.IsNotNull(e.DeviceData, "[TestCase][DeviceData_PROPERTY_READ_ONLY] Failed"); + Assert.IsInstanceOf(e.DeviceData, "[TestCase][DeviceData_PROPERTY_READ_ONLY] Failed"); + pass_DeviceData_PROPERTY_READ_ONLY = true; + } + + if (remote_ble_addr.Equals(default_remote_addr)) + { + LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "Use the first found device"); + } + else if (e.DeviceData.RemoteAddress.Equals(remote_ble_addr)) + { + LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "Found the matching device" + e.DeviceData.RemoteAddress); + } + else + { + LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "Exception: " + e.DeviceData.RemoteAddress); + return; + } + + leDevice = e.DeviceData; + scanFlag = true; + } + } + + public async Task LeScanSetup() + { + BluetoothAdapter.ScanResultChanged += scanResultEventHandler; + if (leDevice == null) + { + BluetoothAdapter.StartLeScan(); + await WaitScanFlag(); + + BluetoothAdapter.StopLeScan(); + await Task.Delay(1000); + + scanFlag = false; + } + + BluetoothAdapter.ScanResultChanged -= scanResultEventHandler; + return leDevice; + } + + public async Task LeDeviceCombine_TEST() + { + try + { + /* LE Scan senario */ + Log.Info("TCT", "[LeDeviceCombine_TEST] Start LE Scan senario "); + leDevice = await LeScanSetup(); + Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); + + /* PASS condition for AddressType_PROPERTY */ + Assert.IsInstanceOf(leDevice.AddressType, "[TestCase][pass_AddressType_PROPERTY_READ_ONLY] Fail"); + Assert.True(Enum.IsDefined(typeof(BluetoothLeDeviceAddressType), leDevice.AddressType), "[TestCase][pass_AddressType_PROPERTY_READ_ONLY] Fail"); + pass_AddressType_PROPERTY_READ_ONLY = true; + + /* PASS condition for AdvertsingDataInformation_PROPERTY_READ_ONLY */ + Assert.IsNotNull(leDevice.AdvertsingDataInformation, "[TestCase][AdvertsingDataInformation_PROPERTY_READ_ONLY] Fail"); + Assert.IsInstanceOf(leDevice.AdvertsingDataInformation.Length, "[TestCase][AdvertsingDataInformation_PROPERTY_READ_ONLY] Fail"); + Assert.True(leDevice.AdvertsingDataInformation.Length > 0, "[TestCase][AdvertsingDataInformation_PROPERTY_READ_ONLY] Fail"); + pass_AdvertsingDataInformation_PROPERTY_READ_ONLY = true; + + /* PASS condition for Appearance_PROPERTY_READ_ONLY */ + leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; + int appearance = leDevice.Appearance; + if (appearance == -1) + { + leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; + appearance = leDevice.Appearance; + if (appearance == -1) + Assert.Fail("[TestCase][Appearance_PROPERTY] Appearance not found in any packet data FAIL"); + } + Assert.IsInstanceOf(leDevice.Appearance); + pass_Appearance_PROPERTY_READ_ONLY = true; + + /* PASS condition for DeviceName_PROPERTY_READ_ONLY */ + leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; + string deviceName = leDevice.DeviceName; + if (deviceName == null) + { + leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; + deviceName = leDevice.DeviceName; + Assert.IsNotNull(deviceName, "[TestCase][DeviceName_PROPERTY_READ_ONLY] Device name not found in any packet data FAIL"); + } + Assert.IsInstanceOf(leDevice.DeviceName); + pass_DeviceName_PROPERTY_READ_ONLY = true; + + /* PASS condition for ManufacturerData_PROPERTY_READ_ONLY */ + leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; + ManufacturerData data = new ManufacturerData(); + data = leDevice.ManufacturerData; + if (data == null) + { + leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; + data = leDevice.ManufacturerData; + Assert.IsNotNull(data, "[TestCase][DeviceName_PROPERTY] No manufacturer data present in either packet type : FAIL"); + } + + Assert.IsNotNull(data.Data, "Data property of ManufacturerData is not proper"); + Assert.IsInstanceOf(data.DataLength, "DataLength property of ManufacturerData is not proper"); + Assert.IsInstanceOf(data.Id, "Id property of ManufacturerData is not proper"); + pass_ManufacturerData_PROPERTY_READ_ONLY = true; + + /* PASS condition for RemoteAddress_PROPERTY_READ_ONLY */ + Assert.IsNotNull(leDevice.RemoteAddress, "[TestCase][RemoteAddress_PROPERTY] Fail"); + Assert.IsInstanceOf(leDevice.RemoteAddress, "[TestCase][RemoteAddress_PROPERTY] Fail"); + pass_RemoteAddress_PROPERTY_READ_ONLY = true; + + /* PASS condition for Rssi_PROPERTY_READ_ONLY */ + Assert.IsInstanceOf(leDevice.Rssi); + pass_Rssi_PROPERTY_READ_ONLY = true; + + /* PASS condition for ScanDataInformation_PROPERTY_READ_ONLY */ + Assert.IsNotNull(leDevice.ScanDataInformation, "[TestCase][ScanDataInformation_PROPERTY] Fail"); + Assert.IsInstanceOf(leDevice.ScanDataInformation, "[TestCase][ScanDataInformation_PROPERTY] Fail"); + pass_ScanDataInformation_PROPERTY_READ_ONLY = true; + + /* PASS condition for ServiceSolictationUuid_PROPERTY_READ_ONLY */ + leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; + IEnumerable ssuuid = leDevice.ServiceSolictationUuid; + + if (ssuuid == null) { + leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; + ssuuid = leDevice.ServiceSolictationUuid; + } + + /* ServiceSolictationUuid is the optional flag in advertisement data, so it can be NULL */ + if (ssuuid != null) + Assert.IsInstanceOf>(ssuuid, "[TestCase][ServiceSolictationUuid] Fail"); + + pass_ServiceSolictationUuid_PROPERTY_READ_ONLY = true; + + /* PASS condition for ServiceUuid_PROPERTY_READ_ONLY */ + /* ServiceUuid is the optional flag in advertisement data, so it can be NULL */ + IEnumerable svuuid = leDevice.ServiceUuid; + + if (svuuid == null) { + leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; + svuuid = leDevice.ServiceUuid; + } + + /* ServiceUuid is the optional flag in advertisement data, so it can be NULL */ + if (svuuid != null) + Assert.IsInstanceOf>(svuuid, "[TestCase][ServiceUuid_PROPERTY_READ_ONLY] Fail"); + + pass_ServiceUuid_PROPERTY_READ_ONLY = true; + + /* PASS condition for TxPowerLevel_PROPERTY_READ_ONLY */ + int txLevel = leDevice.TxPowerLevel; + Assert.IsInstanceOf(leDevice.TxPowerLevel, "[TestCase][TxPowerLevel_PROPERTY_READ_ONLY] TxPowerLevel is not valid"); + pass_TxPowerLevel_PROPERTY_READ_ONLY = true; + + /* PASS condition for GetServiceDataList_RETURN_LIST */ + leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; + IEnumerable serviceList = leDevice.GetServiceDataList(); + if (serviceList == null) + { + leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; + serviceList = leDevice.GetServiceDataList(); + } + Assert.IsNotNull(serviceList, "[TestCase][GetServiceDataList_RETURN_LIST] No GetServiceDataList found in either packet type : FAIL"); + pass_GetServiceDataList_RETURN_LIST = true; + + /* PASS condition for PacketType_PROPERTY_READ_WRITE */ + BluetoothLePacketType PacketType; + leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; + PacketType = leDevice.PacketType; + Assert.AreEqual(BluetoothLePacketType.BluetoothLeScanResponsePacket, PacketType); + + leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; + PacketType = leDevice.PacketType; + Assert.AreEqual(BluetoothLePacketType.BluetoothLeAdvertisingPacket, PacketType); + pass_PacketType_PROPERTY_READ_WRITE = true; + + /* PASS condition for GetAppearance_RETURN_VALUE */ + appearance = leDevice.GetAppearance(BluetoothLePacketType.BluetoothLeAdvertisingPacket); + if (appearance == -1) + appearance = leDevice.GetAppearance(BluetoothLePacketType.BluetoothLeScanResponsePacket); + + Assert.AreNotEqual(appearance, -1, "[TestCase][GetAppearance_RETURN_VALUE] Appearance not found in any packet data: FAIL"); + Assert.IsInstanceOf(appearance); + pass_GetAppearance_RETURN_VALUE = true; + + /* PASS condition for GetDeviceName_RETURN_VALUE */ + deviceName = leDevice.GetDeviceName(BluetoothLePacketType.BluetoothLeAdvertisingPacket); + if (deviceName == null) + deviceName = leDevice.GetDeviceName(BluetoothLePacketType.BluetoothLeScanResponsePacket); + + Assert.IsNotNull(deviceName, "[TestCase][GetDeviceName_RETURN_VALUE] Device name not found in any packet data FAIL"); + Assert.IsInstanceOf(deviceName); + pass_GetDeviceName_RETURN_VALUE = true; + + /* PASS condition for GetManufacturerData_RETURN_VALUE */ + data = leDevice.GetManufacturerData(BluetoothLePacketType.BluetoothLeAdvertisingPacket); + if (data == null) + data = leDevice.GetManufacturerData(BluetoothLePacketType.BluetoothLeScanResponsePacket); + + Assert.IsNotNull(data, "[TestCase][GetManufacturerData_RETURN_VALUE] No manufacturer data present in either packet type : FAIL"); + Assert.IsNotNull(data.Data, "Data property of ManufacturerData is not proper"); + Assert.IsInstanceOf(data.DataLength, "DataLength property of ManufacturerData is not proper"); + Assert.IsInstanceOf(data.Id, "Id property of ManufacturerData is not proper"); + pass_GetManufacturerData_RETURN_VALUE = true; + + /* PASS condition for GetServiceSolicitationUuid_RETURN_VALUE */ + /* ServiceSolictationUuid is the optional flag in advertisement data, so it can be NULL */ + ssuuid = leDevice.GetServiceSolicitationUuid(BluetoothLePacketType.BluetoothLeAdvertisingPacket); + + if (ssuuid == null) + ssuuid = leDevice.GetServiceSolicitationUuid(BluetoothLePacketType.BluetoothLeScanResponsePacket); + + /* ServiceSolictationUuid is the optional flag in advertisement data, so it can be NULL */ + if (ssuuid != null) + Assert.IsInstanceOf>(ssuuid, "[TestCase][ServiceSolictationUuid] Fail"); + + pass_GetServiceSolicitationUuid_RETURN_VALUE = true; + + /* PASS condition for GetServiceUuid_RETURN_VALUE */ + svuuid = leDevice.GetServiceUuid(BluetoothLePacketType.BluetoothLeAdvertisingPacket); + + if (svuuid == null) + svuuid = leDevice.GetServiceUuid(BluetoothLePacketType.BluetoothLeScanResponsePacket); + + /* ServiceUuid is the optional flag in advertisement data, so it can be NULL */ + if (svuuid != null) + Assert.IsInstanceOf>(svuuid, "[TestCase][GetServiceUuid_RETURN_VALUE] Fail"); + + pass_GetServiceUuid_RETURN_VALUE = true; + + /* PASS condition for GetTxPowerLevel_RETURN_VALUE */ + txLevel = leDevice.GetTxPowerLevel(BluetoothLePacketType.BluetoothLeAdvertisingPacket); + Assert.IsInstanceOf(txLevel, "BluetoothLeDevice TxPowerLevel is not valid"); + pass_GetTxPowerLevel_RETURN_VALUE = true; + + /* PASS condition for GetServiceDataList_RETURN_VALUE */ + serviceList = leDevice.GetServiceDataList(BluetoothLePacketType.BluetoothLeAdvertisingPacket); + if (serviceList == null) + serviceList = leDevice.GetServiceDataList(BluetoothLePacketType.BluetoothLeScanResponsePacket); + + Assert.IsNotNull(serviceList, "[TestCase][GetServiceDataList_RETURN_VALUE Property] No GetServiceDataList found in either packet type : FAIL"); + Assert.AreNotEqual(serviceList.Count(), 0, "Count of serviceList is 0"); + pass_GetServiceDataList_RETURN_VALUE = true; + + /* GATT connect / disconnect senario */ + Log.Info("TCT", "[LeDeviceCombine_TEST] Start GATT client connection senario "); + + EventHandler LeDevice_GattConnectionStateChanged = null; + + LeDevice_GattConnectionStateChanged = (sender, e) => { + /* PASS condition for GattConnectionStateChanged_CHECK_EVENT */ + pass_GattConnectionStateChanged_CHECK_EVENT = true; + + Log.Info(Globals.LogTag, "GattConnectionStateChanged invoked!! Result: " + e.Result + ", IsConnected: " + e.IsConnected); + + if (e.Result == 0 && e.IsConnected == true) + { + isGattConnected = true; + } + else if (e.Result == 0 && e.IsConnected == false) + { + leDevice.GattConnectionStateChanged -= LeDevice_GattConnectionStateChanged; + isGattConnected = false; + } + }; + + /* PASS condition for GattConnect_RETURN_VALUE */ + client = leDevice.GattConnect(true); + pass_GattConnect_RETURN_VALUE = true; + + leDevice.GattConnectionStateChanged += LeDevice_GattConnectionStateChanged; + + await Task.Delay(2000); + + /* PASS condition for GattDisconnect_RETURN_VALUE */ + leDevice.GattDisconnect(); + pass_GattDisconnect_RETURN_VALUE = true; + + await Task.Delay(2000); + } + catch (NotSupportedException) + { + if (isBluetoothGattClientSupported == false) + Log.Info(Globals.LogTag, "Not Supported"); + } + catch (TypeInitializationException e) + { + if (isBluetoothGattClientSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) + Log.Info(Globals.LogTag, "Not Supported"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (leDevice != null && isGattConnected == true) + { + leDevice.GattDisconnect(); + await Task.Delay(2000); + isGattConnected = false; + } + client?.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Test Result. Check the Result value")] + [Property("SPEC", "Tizen.Network.Bluetooth.AdapterLeScanResultChangedEventArgs.Result A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task Result_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Result_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_Result_PROPERTY_READ_ONLY, "[TestCase][Result_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test DeviceData. Check the DeviceData value")] + [Property("SPEC", "Tizen.Network.Bluetooth.AdapterLeScanResultChangedEventArgs.DeviceData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task DeviceData_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("DeviceData_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_DeviceData_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_DeviceData_PROPERTY_READ_ONLY, "[TestCase][DeviceData_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test AddressType property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.AddressType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task AddressType_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("AddressType_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_AddressType_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_AddressType_PROPERTY_READ_ONLY, "[TestCase][AddressType_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test AdvertsingDataInformation property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.AdvertsingDataInformation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task AdvertsingDataInformation_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("AdvertsingDataInformation_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_AdvertsingDataInformation_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_AdvertsingDataInformation_PROPERTY_READ_ONLY, "[TestCase][AdvertsingDataInformation_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test Appearance property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.Appearance A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task Appearance_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("Appearance_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Appearance_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_Appearance_PROPERTY_READ_ONLY, "[TestCase][Appearance_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test DeviceName property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.DeviceName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task DeviceName_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("DeviceName_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_DeviceName_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_DeviceName_PROPERTY_READ_ONLY, "[TestCase][DeviceName_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test ManufacturerData property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ManufacturerData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ManufacturerData_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("ManufacturerData_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ManufacturerData_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_ManufacturerData_PROPERTY_READ_ONLY, "[TestCase][ManufacturerData_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test RemoteAddress property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.RemoteAddress A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task RemoteAddress_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("RemoteAddress_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_RemoteAddress_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_RemoteAddress_PROPERTY_READ_ONLY, "[TestCase][RemoteAddress_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test Rssi property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.Rssi A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task Rssi_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("Rssi_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Rssi_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_Rssi_PROPERTY_READ_ONLY, "[TestCase][Rssi_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test ScanDataInformation property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ScanDataInformation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ScanDataInformation_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("ScanDataInformation_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ScanDataInformation_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_ScanDataInformation_PROPERTY_READ_ONLY, "[TestCase][ScanDataInformation_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test ServiceSolictationUuid property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ServiceSolictationUuid A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ServiceSolictationUuid_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("ServiceSolictationUuid_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ServiceSolictationUuid_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_ServiceSolictationUuid_PROPERTY_READ_ONLY, "[TestCase][ServiceSolictationUuid_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test ServiceUuid property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ServiceUuid A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ServiceUuid_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("ServiceUuid_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ServiceUuid_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_ServiceUuid_PROPERTY_READ_ONLY, "[TestCase][ServiceUuid_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test TxPowerLevel property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.TxPowerLevel A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task TxPowerLevel_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("TxPowerLevel_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_TxPowerLevel_PROPERTY_READ_ONLY == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_TxPowerLevel_PROPERTY_READ_ONLY, "[TestCase][TxPowerLevel_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GetServiceDataList method of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetServiceDataList M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task GetServiceDataList_RETURN_LIST() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("GetServiceDataList_RETURN_LIST"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetServiceDataList_RETURN_LIST == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GetServiceDataList_RETURN_LIST, "[TestCase][GetServiceDataList_RETURN_LIST] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test PacketType property of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.PacketType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task PacketType_PROPERTY_READ_WRITE() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("PacketType_PROPERTY_READ_WRITE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_PacketType_PROPERTY_READ_WRITE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_PacketType_PROPERTY_READ_WRITE, "[TestCase][PacketType_PROPERTY_READ_WRITE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GetAppearance method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetAppearance M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "NA")] + public async Task GetAppearance_RETURN_VALUE() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("GetAppearance_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetAppearance_RETURN_VALUE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GetAppearance_RETURN_VALUE, "[TestCase][GetAppearance_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GetDeviceName method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetDeviceName M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "NA")] + public async Task GetDeviceName_RETURN_VALUE() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("GetDeviceName_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetDeviceName_RETURN_VALUE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GetDeviceName_RETURN_VALUE, "[TestCase][GetDeviceName_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GetManufacturerData method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetManufacturerData M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "NA")] + public async Task GetManufacturerData_RETURN_VALUE() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("GetManufacturerData_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetManufacturerData_RETURN_VALUE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GetManufacturerData_RETURN_VALUE, "[TestCase][GetManufacturerData_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GetServiceSolicitationUuid method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetServiceSolicitationUuid M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "NA")] + public async Task GetServiceSolicitationUuid_RETURN_VALUE() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("GetServiceSolicitationUuid_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetServiceSolicitationUuid_RETURN_VALUE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GetServiceSolicitationUuid_RETURN_VALUE, "[TestCase][GetServiceSolicitationUuid_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GetServiceUuid method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetServiceUuid M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "NA")] + public async Task GetServiceUuid_RETURN_VALUE() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("GetServiceUuid_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetServiceUuid_RETURN_VALUE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GetServiceUuid_RETURN_VALUE, "[TestCase][GetServiceUuid_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GetTxPowerLevel method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetTxPowerLevel M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "NA")] + public async Task GetTxPowerLevel_RETURN_VALUE() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("GetTxPowerLevel_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetTxPowerLevel_RETURN_VALUE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GetTxPowerLevel_RETURN_VALUE, "[TestCase][GetTxPowerLevel_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GetServiceDataList method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetServiceDataList M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("COVPARAM", "Tizen.Network.Bluetooth.BluetoothLePacketType")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "NA")] + public async Task GetServiceDataList_RETURN_VALUE() + { + /* We can't occupy the precondition, if BLE feature is not supported in Manual TC */ + if (isBluetoothLeSupported == false) + { + BluetoothHelper.DisplayLabel("GetServiceDataList_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetServiceDataList_RETURN_VALUE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GetServiceDataList_RETURN_VALUE, "[TestCase][GetServiceDataList_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GattConnect method of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GattConnect M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")] + [Precondition(1, "Bluetooth should be turned on.")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button.")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "If TC fails, turn off and turn on Bluetooth. Try again.")] + public async Task GattConnect_RETURN_VALUE() + { + /* We can't occupy the precondition, if GATT client feature is not supported in Manual TC */ + if (isBluetoothGattClientSupported == false) + { + BluetoothHelper.DisplayLabel("GattConnect_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GattConnect_RETURN_VALUE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GattConnect_RETURN_VALUE, "[TestCase][GattConnect_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GattDisconnect method of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GattDisconnect M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")] + [Precondition(1, "Bluetooth should be turned on.")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button.")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "If TC fails, turn off and turn on Bluetooth. Try again.")] + public async Task GattDisconnect_RETURN_VALUE() + { + /* We can't occupy the precondition, if GATT client feature is not supported in Manual TC */ + if (isBluetoothGattClientSupported == false) + { + BluetoothHelper.DisplayLabel("GattDisconnect_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GattDisconnect_RETURN_VALUE == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GattDisconnect_RETURN_VALUE, "[TestCase][GattDisconnect_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test GattConnectionStateChanged event of BluetoothLeDevice")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GattConnectionStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")] + [Precondition(1, "Bluetooth should be turned on.")] + [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] + [Step(1, "Tap the Run button.")] + [Step(2, "TC should pass automatically.")] + [Postcondition(1, "If TC fails, turn off and turn on Bluetooth. Try again.")] + public async Task GattConnectionStateChanged_CHECK_EVENT() + { + /* We can't occupy the precondition, if GATT client feature is not supported in Manual TC */ + if (isBluetoothGattClientSupported == false) + { + BluetoothHelper.DisplayLabel("GattConnectionStateChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GattConnectionStateChanged_CHECK_EVENT == false) + await LeDeviceCombine_TEST(); + + Assert.True(pass_GattConnectionStateChanged_CHECK_EVENT, "[TestCase][GattConnectionStateChanged_CHECK_EVENT] Fail"); + } + } +} diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothLeDevice.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothLeDevice.cs deleted file mode 100644 index 65c41df..0000000 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothLeDevice.cs +++ /dev/null @@ -1,1565 +0,0 @@ -using System; -using System.Threading.Tasks; -using BluetoothNetworkUtils; -using System.Linq; -using System.Collections.Generic; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Tizen.System; -using Xamarin.Forms; - -namespace Tizen.Network.Bluetooth.Tests -{ - [TestFixture] - [Description("BluetoothLeDevice Tests")] - public class BluetoothLeDeviceTests - { - BluetoothLeDevice leDevice = null; - bool isBluetoothLeSupported = false; - bool isBluetoothGattClientSupported = false; - bool isGattConnected = false; - BluetoothGattClient client = null; - - [SetUp] - public void Init() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le", out isBluetoothLeSupported); - Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le.gatt.client", out isBluetoothGattClientSupported); - } - - [TearDown] - public void Destroy() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Test AddressType property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.AddressType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task AddressType_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("AddressType_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // Test case scenarios can't be generated for individual BluetoothLeDeviceAddressType enum - // values as the value is getting set from capi framework. - Assert.IsInstanceOf(leDevice.AddressType, "[TestCase][AddressType_PROPERTY] Fail"); - Assert.True(Enum.IsDefined(typeof(BluetoothLeDeviceAddressType), leDevice.AddressType), "[TestCase][AddressType_PROPERTY] Fail"); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("AddressType_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("AddressType_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test AdvertsingDataInformation property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.AdvertsingDataInformation A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task AdvertsingDataInformation_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("AdvertsingDataInformation_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - Assert.IsNotNull(leDevice.AdvertsingDataInformation, "[TestCase][AdvertsingDataInformation_PROPERTY_READ_ONLY] Fail"); - Assert.IsInstanceOf(leDevice.AdvertsingDataInformation.Length, "[TestCase][AdvertsingDataInformation_PROPERTY_READ_ONLY] Fail"); - Assert.True(leDevice.AdvertsingDataInformation.Length > 0, "[TestCase][AdvertsingDataInformation_PROPERTY_READ_ONLY] Fail"); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("AdvertsingDataInformation_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("AdvertsingDataInformation_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test Appearance property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.Appearance A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task Appearance_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("Appearance_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - Log.Info("TCT", "[TestCase][DeviceName_PROPERTY] Packet type is set to BluetoothLeAdvertisingPacket"); - leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; - int appearance = leDevice.Appearance; - if (appearance == -1) - { - leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; - appearance = leDevice.Appearance; - if (appearance == -1) - { - Assert.Fail("[TestCase][Appearance_PROPERTY] Appearance not found in any packet data FAIL"); - } - } - - Assert.IsInstanceOf(leDevice.Appearance); - Log.Info("TCT", "[TestCase][Appearance_PROPERTY] Pass" + appearance); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("Appearance_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Appearance_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test DeviceName property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.DeviceName A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task DeviceName_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("DeviceName_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - Log.Info("TCT", "[TestCase][DeviceName_PROPERTY] Packet type is set to BluetoothLeAdvertisingPacket"); - leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; - string deviceName = leDevice.DeviceName; - if (deviceName == null) - { - leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; - deviceName = leDevice.DeviceName; - Assert.IsNotNull(deviceName, "[TestCase][DeviceName_PROPERTY] Device name not found in any packet data FAIL"); - } - - Assert.IsInstanceOf(leDevice.DeviceName); - Log.Info("TCT", "[TestCase][DeviceName_PROPERTY] Pass : Device name is : " + deviceName); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("DeviceName_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("DeviceName_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test ManufacturerData property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ManufacturerData A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task ManufacturerData_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("ManufacturerData_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; - ManufacturerData data = new ManufacturerData(); - data = leDevice.ManufacturerData; - if (data == null) - { - leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; - data = leDevice.ManufacturerData; - Assert.IsNotNull(data, "[TestCase][DeviceName_PROPERTY] No manufacturer data present in either packet type : FAIL"); - } - - Assert.IsNotNull(data.Data, "Data property of ManufacturerData is not proper"); - Assert.IsInstanceOf(data.DataLength, "DataLength property of ManufacturerData is not proper"); - Assert.IsInstanceOf(data.Id, "Id property of ManufacturerData is not proper"); - Log.Info("TCT", "[TestCase][ManufacturerData_PROPERTY] PASS: Found Manufacturer data Id : " + data.Id + " Length : " + data.DataLength); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("ManufacturerData_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("ManufacturerData_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test RemoteAddress property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.RemoteAddress A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task RemoteAddress_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("RemoteAddress_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - Assert.IsNotNull(leDevice.RemoteAddress, "[TestCase][RemoteAddress_PROPERTY] Fail"); - Assert.IsInstanceOf(leDevice.RemoteAddress, "[TestCase][RemoteAddress_PROPERTY] Fail"); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("RemoteAddress_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("RemoteAddress_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test Rssi property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.Rssi A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task Rssi_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("Rssi_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - Assert.IsInstanceOf(leDevice.Rssi); - Log.Info("TCT", "[TestCase][Rssi_PROPERTY] Pass" + leDevice.Rssi); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("Rssi_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Rssi_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test ScanDataInformation property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ScanDataInformation A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task ScanDataInformation_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("ScanDataInformation_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - byte[] scanDataInfo = leDevice.ScanDataInformation; - if (scanDataInfo != null && scanDataInfo.Length > 0) - { - Log.Info("TCT", "[TestCase][ScanDataInformation_PROPERTY] PASS: Found Scan Data of length : " + scanDataInfo.Length); - } - else - { - Assert.Fail("ScanDataInformation byte array is not proper or not available"); - } - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("ScanDataInformation_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("ScanDataInformation_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test ServiceSolictationUuid property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ServiceSolictationUuid A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task ServiceSolictationUuid_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("ServiceSolictationUuid_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; - IEnumerable ssuuid = leDevice.ServiceSolictationUuid; - if (ssuuid == null) - { - leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; - ssuuid = leDevice.ServiceSolictationUuid; - - Assert.IsNotNull(ssuuid, "[TestCase][ServiceSolictationUuid_PROPERTY] No SSUID data found in either packet type : FAIL"); - } - - foreach (string uuid in ssuuid) - { - Log.Info("TCT", "[TestCase][ServiceSolictationUuid_PROPERTY] UUID is : " + uuid); - } - Log.Info("TCT", "[TestCase][ServiceSolictationUuid] PASS"); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("ServiceSolictationUuid_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("ServiceSolictationUuid_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test ServiceUuid property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ServiceUuid A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task ServiceUuid_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("ServiceUuid_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; - IEnumerable svcuuid = leDevice.ServiceUuid; - if (svcuuid == null) - { - leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; - svcuuid = leDevice.ServiceUuid; - - Assert.IsNotNull(svcuuid, "[TestCase][ServiceUuid_PROPERTY_READ_ONLY] No SVC UUID found in either packet type : FAIL"); - } - - foreach (string uuid in svcuuid) - { - Log.Info("TCT", "[TestCase][ServiceUuid_PROPERTY] UUID is : " + uuid); - } - Log.Info("TCT", "[TestCase][ServiceUuid_PROPERTY] PASS"); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("ServiceUuid_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("ServiceUuid_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test TxPowerLevel property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.TxPowerLevel A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task TxPowerLevel_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("TxPowerLevel_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; - int txLevel = leDevice.TxPowerLevel; - if (txLevel == -1) - { - leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; - txLevel = leDevice.TxPowerLevel; - if (txLevel == -1) - { - Assert.Fail("[TestCase][TxPowerLevel_PROPERTY] - No TxPowerLevel data found in either packet type : FAIL "); - } - } - - Assert.IsInstanceOf(leDevice.TxPowerLevel, "BluetoothLeDevice TxPowerLevel is not valid"); - Log.Info("TCT", "[TestCase][TxPowerLevel_PROPERTY] Pass - Tx Power Level is : " + txLevel); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("TxPowerLevel_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("TxPowerLevel_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test GetServiceDataList method of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetServiceDataList M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task GetServiceDataList_RETURN_LIST() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetServiceDataList_RETURN_LIST"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; - IEnumerable serviceList = leDevice.GetServiceDataList(); - if (serviceList == null) - { - leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; - serviceList = leDevice.GetServiceDataList(); - - Assert.IsNotNull(serviceList, "[TestCase][GetServiceDataList Property] No GetServiceDataList found in either packet type : FAIL"); - } - - foreach (BluetoothLeServiceData data in serviceList) - { - Log.Info("TCT", "[TestCase][GetServiceDataList_RETURN_LIST] PASS: Retrieved service data list UUID : " + data.ServiceUuid + " length is " + data.ServiceDataLength); - } - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetServiceDataList_RETURN_LIST"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetServiceDataList_RETURN_LIST"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test PacketType property of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.PacketType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task PacketType_PROPERTY_READ_WRITE() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("PacketType_PROPERTY_READ_WRITE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - BluetoothLePacketType PacketType; - leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket; - PacketType = leDevice.PacketType; - Assert.AreEqual(BluetoothLePacketType.BluetoothLeScanResponsePacket, PacketType); - - leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket; - PacketType = leDevice.PacketType; - Assert.AreEqual(BluetoothLePacketType.BluetoothLeAdvertisingPacket, PacketType); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("PacketType_PROPERTY_READ_WRITE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("PacketType_PROPERTY_READ_WRITE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test GattConnect method of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GattConnect M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")] - [Precondition(1, "Bluetooth should be turned on.")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button.")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "If TC fails, turn off and turn on Bluetooth. Try again.")] - public async Task GattConnect_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if GATT Client feature is not supported in Manual TC */ - if (isBluetoothGattClientSupported == false) - { - BluetoothHelper.DisplayLabel("GattConnect_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - EventHandler LeDevice_GattConnectionStateChanged = null; - - LeDevice_GattConnectionStateChanged = (sender, e) => { - Log.Info(Globals.LogTag, "GattConnectionStateChanged invoked!! Result: " + e.Result + ", IsConnected: " + e.IsConnected); - leDevice.GattConnectionStateChanged -= LeDevice_GattConnectionStateChanged; - if (e.Result == 0 && e.IsConnected == true) - { - isGattConnected = true; - ManualTest.Confirm(); - } - else - { - ManualTest.ConfirmFail("GattConnect_RETURN_VALUE"); - } - }; - - client = leDevice.GattConnect(true); - leDevice.GattConnectionStateChanged += LeDevice_GattConnectionStateChanged; - await ManualTest.WaitForConfirm(); - } - catch (NotSupportedException) - { - if (isBluetoothGattClientSupported == false) - { - BluetoothHelper.DisplayLabel("GattConnect_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothGattClientSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GattConnect_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (leDevice != null && isGattConnected == true) - { - leDevice.GattDisconnect(); - await Task.Delay(2000); - isGattConnected = false; - } - client?.Dispose(); - } - } - - [Test] - [Category("P1")] - [Description("Test GattDisconnect method of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GattDisconnect M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")] - [Precondition(1, "Bluetooth should be turned on.")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button.")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "If TC fails, turn off and turn on Bluetooth. Try again.")] - public async Task GattDisconnect_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if GATT Client feature is not supported in Manual TC */ - if (isBluetoothGattClientSupported == false) - { - BluetoothHelper.DisplayLabel("GattDisconnect_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - EventHandler LeDevice_GattConnectionStateChanged = null; - - LeDevice_GattConnectionStateChanged = (sender, e) => { - Log.Info(Globals.LogTag, "GattConnectionStateChanged invoked!! Result: " + e.Result + ", IsConnected: " + e.IsConnected); - - if (e.Result == 0 && e.IsConnected == true) - { - isGattConnected = true; - ManualTest.Confirm(); - } - else if (e.Result == 0 && e.IsConnected == false) - { - leDevice.GattConnectionStateChanged -= LeDevice_GattConnectionStateChanged; - isGattConnected = false; - ManualTest.Confirm(); - } - }; - - client = leDevice.GattConnect(true); - leDevice.GattConnectionStateChanged += LeDevice_GattConnectionStateChanged; - await ManualTest.WaitForConfirm(); - - leDevice.GattDisconnect(); - await ManualTest.WaitForConfirm(); - } - catch (NotSupportedException) - { - if (isBluetoothGattClientSupported == false) - { - BluetoothHelper.DisplayLabel("GattDisconnect_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothGattClientSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GattDisconnect_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (leDevice != null && isGattConnected == true) - { - leDevice.GattDisconnect(); - await Task.Delay(2000); - isGattConnected = false; - } - client?.Dispose(); - } - } - - [Test] - [Category("P1")] - [Description("Test GattConnectionStateChanged event of BluetoothLeDevice")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GattConnectionStateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")] - [Precondition(1, "Bluetooth should be turned on.")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button.")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "If TC fails, turn off and turn on Bluetooth. Try again.")] - public async Task GattConnectionStateChanged_CHECK_EVENT() - { - try - { - /* We can't occupy the precondition, if GATT Client is not supported in Manual TC */ - if (isBluetoothGattClientSupported == false) - { - BluetoothHelper.DisplayLabel("GattConnectionStateChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - EventHandler LeDevice_GattConnectionStateChanged = null; - - LeDevice_GattConnectionStateChanged = (sender, e) => { - Log.Info(Globals.LogTag, "GattConnectionStateChanged invoked!! Result: " + e.Result + ", IsConnected: " + e.IsConnected); - - leDevice.GattConnectionStateChanged -= LeDevice_GattConnectionStateChanged; - if (e.Result == 0) - { - isGattConnected = e.IsConnected; - ManualTest.Confirm(); - } - }; - - if (isGattConnected == true) - { - leDevice.GattDisconnect(); - } - else - { - client = leDevice.GattConnect(true); - } - leDevice.GattConnectionStateChanged += LeDevice_GattConnectionStateChanged; - await ManualTest.WaitForConfirm(); - } - catch (NotSupportedException) - { - if (isBluetoothGattClientSupported == false) - { - BluetoothHelper.DisplayLabel("GattConnectionStateChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothGattClientSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GattConnectionStateChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (leDevice != null && isGattConnected == true) - { - leDevice.GattDisconnect(); - await Task.Delay(2000); - isGattConnected = false; - } - client?.Dispose(); - } - } - - [Test] - [Category("P1")] - [Description("Test GetAppearance method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetAppearance M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "NA")] - public async Task GetAppearance_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetAppearance_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - int appearance = leDevice.GetAppearance(BluetoothLePacketType.BluetoothLeAdvertisingPacket); - if (appearance == -1) - { - appearance = leDevice.GetAppearance(BluetoothLePacketType.BluetoothLeScanResponsePacket); - Assert.AreNotEqual(appearance, -1, "[TestCase][GetAppearance_RETURN_VALUE] Appearance not found in any packet data: FAIL"); - } - - Assert.IsInstanceOf(appearance); - Log.Info("TCT", "[TestCase][GetAppearance_RETURN_VALUE] Pass" + appearance); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetAppearance_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetAppearance_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test GetDeviceName method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetDeviceName M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "NA")] - public async Task GetDeviceName_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetDeviceName_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - string deviceName = leDevice.GetDeviceName(BluetoothLePacketType.BluetoothLeAdvertisingPacket); - if (deviceName == null) - { - deviceName = leDevice.GetDeviceName(BluetoothLePacketType.BluetoothLeScanResponsePacket); - Assert.IsNotNull(deviceName, "[TestCase][GetDeviceName_RETURN_VALUE] Device name not found in any packet data FAIL"); - } - - Assert.IsInstanceOf(deviceName); - Log.Info("TCT", "[TestCase][GetDeviceName_RETURN_VALUE] Pass : Device name is : " + deviceName); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetDeviceName_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetDeviceName_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test GetManufacturerData method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetManufacturerData M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "NA")] - public async Task GetManufacturerData_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetManufacturerData_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - ManufacturerData data = leDevice.GetManufacturerData(BluetoothLePacketType.BluetoothLeAdvertisingPacket); - if (data == null) - { - data = leDevice.GetManufacturerData(BluetoothLePacketType.BluetoothLeScanResponsePacket); - Assert.IsNotNull(data, "[TestCase][GetManufacturerData_RETURN_VALUE] No manufacturer data present in either packet type : FAIL"); - } - - Assert.IsNotNull(data.Data, "Data property of ManufacturerData is not proper"); - Assert.IsInstanceOf(data.DataLength, "DataLength property of ManufacturerData is not proper"); - Assert.IsInstanceOf(data.Id, "Id property of ManufacturerData is not proper"); - Log.Info("TCT", "[TestCase][GetManufacturerData_RETURN_VALUE] PASS: Found Manufacturer data Id : " + data.Id + " Length : " + data.DataLength); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetManufacturerData_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetManufacturerData_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test GetServiceSolicitationUuid method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetServiceSolicitationUuid M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "NA")] - public async Task GetServiceSolicitationUuid_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetServiceSolicitationUuid_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - IEnumerable ssuuid = leDevice.GetServiceSolicitationUuid(BluetoothLePacketType.BluetoothLeAdvertisingPacket); - if (ssuuid == null) - { - ssuuid = leDevice.GetServiceSolicitationUuid(BluetoothLePacketType.BluetoothLeScanResponsePacket); - Assert.IsNotNull(ssuuid, "[TestCase][GetServiceSolicitationUuid_RETURN_VALUE] No SSUUID data found in either packet type : FAIL"); - } - - Assert.AreNotEqual(ssuuid.Count(), 0, "Count of ssuuid is 0"); - foreach (string uuid in ssuuid) - { - Assert.IsInstanceOf(uuid, "uuid is not string"); - Log.Info("TCT", "[TestCase][GetServiceSolicitationUuid_RETURN_VALUE] UUID is : " + uuid); - } - Log.Info("TCT", "[TestCase][GetServiceSolicitationUuid_RETURN_VALUE] PASS"); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetServiceSolicitationUuid_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetServiceSolicitationUuid_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test GetServiceUuid method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetServiceUuid M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "NA")] - public async Task GetServiceUuid_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetServiceUuid_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - IEnumerable svcuuid = leDevice.GetServiceUuid(BluetoothLePacketType.BluetoothLeAdvertisingPacket); - if (svcuuid == null) - { - svcuuid = leDevice.GetServiceUuid(BluetoothLePacketType.BluetoothLeScanResponsePacket); - Assert.IsNotNull(svcuuid, "[TestCase][GetServiceUuid_RETURN_VALUE] No SVC UUID found in either packet type : FAIL"); - } - - Assert.AreNotEqual(svcuuid.Count(), 0, "Count of svcuuid is 0"); - foreach (string uuid in svcuuid) - { - Assert.IsInstanceOf(uuid, "uuid is not string"); - Log.Info("TCT", "[TestCase][GetServiceUuid_RETURN_VALUE] UUID is : " + uuid); - } - Log.Info("TCT", "[TestCase][GetServiceUuid_RETURN_VALUE] PASS"); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetServiceUuid_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetServiceUuid_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test GetTxPowerLevel method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetTxPowerLevel M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "NA")] - public async Task GetTxPowerLevel_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetTxPowerLevel_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - int txLevel = leDevice.GetTxPowerLevel(BluetoothLePacketType.BluetoothLeAdvertisingPacket); - if (txLevel == -1) - { - txLevel = leDevice.GetTxPowerLevel(BluetoothLePacketType.BluetoothLeScanResponsePacket); - Assert.AreNotEqual(txLevel, -1, "[TestCase][GetTxPowerLevel_RETURN_VALUE] - No TxPowerLevel data found in either packet type: FAIL"); - } - - Assert.IsInstanceOf(txLevel, "BluetoothLeDevice TxPowerLevel is not valid"); - Log.Info("TCT", "[TestCase][GetTxPowerLevel_RETURN_VALUE] Pass - Tx Power Level is : " + txLevel); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetTxPowerLevel_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetTxPowerLevel_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test GetServiceDataList method of BluetoothLeDevice and it throws InvalidOperationException when the Bluetooth LE is not enabled.")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetServiceDataList M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("COVPARAM", "Tizen.Network.Bluetooth.BluetoothLePacketType")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")] - [Precondition(2, "Run BluetoothGattServerTests.NotificationSent_CHECK_EVENT test case on server device.")] - [Step(1, "Tap the Run button")] - [Step(2, "TC should pass automatically.")] - [Postcondition(1, "NA")] - public async Task GetServiceDataList_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */ - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetServiceDataList_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (leDevice == null) - { - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null"); - } - - // TEST CODE - IEnumerable serviceList = leDevice.GetServiceDataList(BluetoothLePacketType.BluetoothLeAdvertisingPacket); - if (serviceList == null) - { - serviceList = leDevice.GetServiceDataList(BluetoothLePacketType.BluetoothLeScanResponsePacket); - Assert.IsNotNull(serviceList, "[TestCase][GetServiceDataList_RETURN_VALUE Property] No GetServiceDataList found in either packet type : FAIL"); - } - - Assert.AreNotEqual(serviceList.Count(), 0, "Count of serviceList is 0"); - foreach (BluetoothLeServiceData data in serviceList) - { - Assert.IsNotNull(data.ServiceData, "ServiceData is null"); - Assert.IsInstanceOf(data.ServiceDataLength, "ServiceDataLength is not int"); - Assert.IsInstanceOf(data.ServiceUuid, "ServiceUuid is not string"); - Log.Info("TCT", "[TestCase][GetServiceDataList_RETURN_VALUE] PASS: Retrieved service data list UUID : " + data.ServiceUuid + " length is " + data.ServiceDataLength); - } - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("GetServiceDataList_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetServiceDataList_RETURN_VALUE"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - } -}