From 2a1524abd054a3c71903ca4449ae7e34e9e220e7 Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Tue, 31 Aug 2021 13:19:04 +0900 Subject: [PATCH] [Bluetooth][TCSACR-437] Add new gatt related TCs Change-Id: I63e19d31fcebabe501b9fe8228374b8438b8f7d5 Signed-off-by: Wootak Jung --- .../testcase/TSBluetoothCombine1_2_GattClient.cs | 109 ++++++++++++++++++++- .../testcase/TSBluetoothCombine1_3_GattServer.cs | 39 +++++++- 2 files changed, 146 insertions(+), 2 deletions(-) diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine1_2_GattClient.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine1_2_GattClient.cs index 3dc8431..a7b8288 100644 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine1_2_GattClient.cs +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine1_2_GattClient.cs @@ -40,6 +40,9 @@ namespace Tizen.Network.Bluetooth.Tests static bool pass_ValueChanged_CHECK_EVENT = false; static bool pass_Value_ValueChangedEventArgs_READ_ONLY = false; static bool pass_DestroyClient_RETURN_VALUE = false; + static bool pass_ServiceChanged_CHECK_EVENT = false; + static bool pass_ChangeType_ServiceChangedEventArgs_READ_ONLY = false; + static bool pass_ServiceUuid_ServiceChangedEventArgs_READ_ONLY = false; [SetUp] public void Init() @@ -266,6 +269,26 @@ namespace Tizen.Network.Bluetooth.Tests pass_Value_ValueChangedEventArgs_READ_ONLY = true; charc.ValueChanged -= Charc_ValueChanged; + }; + + charc.ValueChanged += Charc_ValueChanged; + + EventHandler OnServiceChanged = null; + + OnServiceChanged = (sender, e) => + { + /* PASS condition for ServiceChanged_CHECK_EVENT */ + pass_ServiceChanged_CHECK_EVENT = true; + + /* PASS condition for ChangeType_ServiceChangedEventArgs_READ_ONLY */ + Assert.IsInstanceOf(e.ChangeType, "[ServiceChangedEventArgs][ChangeType] Failed"); + pass_ChangeType_ServiceChangedEventArgs_READ_ONLY = true; + + /* PASS condition for ServiceUuid_ServiceChangedEventArgs_READ_ONLY */ + Assert.IsNotNull(e.ServiceUuid, "[ServiceChangedEventArgs][ServiceUuid] Failed"); + pass_ServiceUuid_ServiceChangedEventArgs_READ_ONLY = true; + + client.ServiceChanged -= OnServiceChanged; client.DisconnectAsync(); isConnected = false; @@ -287,7 +310,7 @@ namespace Tizen.Network.Bluetooth.Tests BluetoothHelper.DisplayPassLabel("GattClientCombine_TEST"); }; - charc.ValueChanged += Charc_ValueChanged; + client.ServiceChanged += OnServiceChanged; await ManualTest.WaitForConfirm(); } @@ -845,5 +868,89 @@ namespace Tizen.Network.Bluetooth.Tests Assert.True(pass_DestroyClient_RETURN_VALUE, "[TestCase][DestroyClient_RETURN_VALUE] Fail"); } + + [Test] + [Category("P1")] + [Description("Check whether ServiceChanged callback is getting invoked or not")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothGattClient.ServiceChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Wootak Jung, wootak.jung@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Set BT_REMOTE_BLE_DEVICE_ADDRESS, when you launch TCT")] + [Precondition(3, "Run any testcases of class of BluetoothGattServerTests on the remote device")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ServiceChanged_CHECK_EVENT() + { + /* We can't occupy the precondition, if Gatt client feature is not supported in Manual TC */ + if (isBluetoothGattClientSupported == false) + { + BluetoothHelper.DisplayLabel("ServiceChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ServiceChanged_CHECK_EVENT == false) + await GattClientCombine_TEST(); + + Assert.True(pass_ServiceChanged_CHECK_EVENT, "[TestCase][ServiceChanged_CHECK_EVENT] Fail"); + } + + [Test] + [Category("P1")] + [Description("Check Value parameter of ServiceChangedEventArgs")] + [Property("SPEC", "Tizen.Network.Bluetooth.ServiceChangedEventArgs.ChangeType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Wootak Jung, wootak.jung@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Set BT_REMOTE_BLE_DEVICE_ADDRESS, when you launch TCT")] + [Precondition(3, "Run any testcases of class of BluetoothGattServerTests on the remote device")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ChangeType_ServiceChangedEventArgs_READ_ONLY() + { + /* We can't occupy the precondition, if Gatt client feature is not supported in Manual TC */ + if (isBluetoothGattClientSupported == false) + { + BluetoothHelper.DisplayLabel("ChangeType_ServiceChangedEventArgs_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ChangeType_ServiceChangedEventArgs_READ_ONLY == false) + await GattClientCombine_TEST(); + + Assert.True(pass_ChangeType_ServiceChangedEventArgs_READ_ONLY, "[TestCase][ChangeType_ServiceChangedEventArgs_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Check Value parameter of ServiceChangedEventArgs")] + [Property("SPEC", "Tizen.Network.Bluetooth.ServiceChangedEventArgs.ServiceUuid A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Wootak Jung, wootak.jung@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Set BT_REMOTE_BLE_DEVICE_ADDRESS, when you launch TCT")] + [Precondition(3, "Run any testcases of class of BluetoothGattServerTests on the remote device")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ServiceUuid_ServiceChangedEventArgs_READ_ONLY() + { + /* We can't occupy the precondition, if Gatt client feature is not supported in Manual TC */ + if (isBluetoothGattClientSupported == false) + { + BluetoothHelper.DisplayLabel("ServiceUuid_ServiceChangedEventArgs_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ServiceUuid_ServiceChangedEventArgs_READ_ONLY == false) + await GattClientCombine_TEST(); + + Assert.True(pass_ServiceUuid_ServiceChangedEventArgs_READ_ONLY, "[TestCase][ServiceUuid_ServiceChangedEventArgs_READ_ONLY] Fail"); + } } } diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine1_3_GattServer.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine1_3_GattServer.cs index e33e87b..a1e9bc2 100644 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine1_3_GattServer.cs +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine1_3_GattServer.cs @@ -38,6 +38,7 @@ namespace Tizen.Network.Bluetooth.Tests static bool pass_Completed_NotificationSentEventArg_PROPERTY_READ_ONLY = false; static bool pass_Result_NotificationSentEventArg_PROPERTY_READ_ONLY = false; static bool pass_Server_NotificationSentEventArg_PROPERTY_READ_ONLY = false; + static bool pass_GetAttMtu_RETURN_VALUE = false; [SetUp] public void Init() @@ -66,6 +67,7 @@ namespace Tizen.Network.Bluetooth.Tests string clientAddress = null; byte[] charValue = Encoding.UTF8.GetBytes("charValue"); byte[] descValue = { 0, 0 }; + int attMtu = 0; BluetoothGattService srv = null; BluetoothGattCharacteristic charc = null; @@ -226,6 +228,12 @@ namespace Tizen.Network.Bluetooth.Tests Assert.IsInstanceOf(e.ClientAddress, "[NotificationSentEventArg][ClientAddress] Failed"); pass_ClientAddress_NotificationSentEventArg_PROPERTY_READ_ONLY = true; + /* PASS condition for GetAttMtu_RETURN_VALUE */ + attMtu = server.GetAttMtu(e.ClientAddress); + Assert.IsInstanceOf(attMtu, "[GetAttMtu][Completed] Failed"); + Assert.IsTrue(attMtu > 0, "[GetAttMtu][Completed] Failed"); + pass_GetAttMtu_RETURN_VALUE = true; + /* PASS condition for Completed_NotificationSentEventArg_PROPERTY_READ_ONLY */ Assert.IsInstanceOf(e.Completed, "[NotificationSentEventArg][Completed] Failed"); Assert.IsTrue(e.Completed == true, "[NotificationSentEventArg][Completed] Failed"); @@ -242,7 +250,9 @@ namespace Tizen.Network.Bluetooth.Tests Assert.AreSame(server, e.Server); pass_Server_NotificationSentEventArg_PROPERTY_READ_ONLY = true; - BluetoothHelper.DisplayCustomLabel("NotificationSent is success, wait for disconnet"); + BluetoothSetup.gatt_server_exit(); + server = null; + BluetoothHelper.DisplayCustomLabel("server exit, wait for disconnet"); /* Wait for disconnection from client */ Task.Delay(5000).Wait(); @@ -926,5 +936,32 @@ namespace Tizen.Network.Bluetooth.Tests Assert.True(pass_Server_NotificationSentEventArg_PROPERTY_READ_ONLY, "[TestCase][Server_NotificationSentEventArg_PROPERTY_READ_ONLY] Fail"); } + + [Test] + [Category("P1")] + [Description("Check GetAttMtu method of BluetoothGattServer")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothGattServer.GetAttMtu M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Wootak Jung, wootak.jung@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Step(1, "Tap the Run button.\n(If one of test cases of class BluetoothGattServerTests is PASS, you can skip next step)")] + [Step(2, "Run any testcases of class of BluetoothGattClientTests on the remote device.")] + [Postcondition(1, "NA")] + public async Task GetAttMtu_RETURN_VALUE() + { + /* We can't occupy the precondition, if Gatt server feature is not supported in Manual TC */ + if (isBluetoothGattServerSupported == false) + { + BluetoothHelper.DisplayLabel("GetAttMtu_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetAttMtu_RETURN_VALUE == false) + await GattServerCombine_TEST(); + + Assert.True(pass_GetAttMtu_RETURN_VALUE, "[TestCase][GetAttMtu_RETURN_VALUE] Fail"); + } } } -- 2.7.4