[Bluetooth][TCSACR-237] Add tcs for new APIs 36/204336/4
authorWootak Jung <wootak.jung@samsung.com>
Tue, 23 Apr 2019 07:00:53 +0000 (16:00 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 24 Apr 2019 04:17:08 +0000 (13:17 +0900)
Change-Id: I54c3ee7f41f6e455de2479e9d389e13bd33ec561

tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothHelper.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothLeDevice.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSNotificationSentEventArg.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSNotificationStateChangedEventArg.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSReadRequestedEventArgs.cs

index 8e4fcaaaa3594e3e52c1cc26d1218a4155f4339c..af35ad03532ae56cc1e9ddb855cc5d33d6655312 100755 (executable)
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
 using NUnit.Framework;
 using XamarinApplication.Tizen;
 using Xamarin.Forms;
-using Xamarin.Forms;
 using Tizen.Applications;
 
 namespace Tizen.Network.Bluetooth.Tests
index 2d6ae7547b790b5dc0a2b6d5d83f7e7b6918adcf..d210ef4feb609a1a803cc068eb02341423b61a1f 100644 (file)
@@ -1084,5 +1084,464 @@ namespace Tizen.Network.Bluetooth.Tests
                 }
             }
         }
+
+        [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 GATT Server test case on another 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<int>(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 GATT Server test case on another 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<string>(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 GATT Server test case on another 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<int>(data.DataLength, "DataLength property of ManufacturerData is not proper");
+                Assert.IsInstanceOf<int>(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 GATT Server test case on another 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<string> 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<string>(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 GATT Server test case on another 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<string> 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<string>(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 GATT Server test case on another 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<int>(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("AUTHOR", "Shikha, shikha.ta@samsung.com")]
+        [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")]
+        [Precondition(2, "Run GATT Server test case on another 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<BluetoothLeServiceData> 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<int>(data.ServiceDataLength, "ServiceDataLength is not int");
+                    Assert.IsInstanceOf<string>(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());
+            }
+        }
     }
 }
index 15a0f325e07b70e4f37b032a617be7c376f70976..b76f9d669f2a8e41921b503cb05e579b4b6f78d4 100755 (executable)
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
 using BluetoothNetworkUtils;
 using NUnit.Framework;
 using NUnit.Framework.TUnit;
-using System;
 using Xamarin.Forms;
 using Tizen.System;
 
index 82af906a31c3014a6c33dd6fc008f12f74002c6c..b5f39e8485b179c1c1d54a6d1ee47cea1b0fd9db 100755 (executable)
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
 using BluetoothNetworkUtils;
 using NUnit.Framework;
 using NUnit.Framework.TUnit;
-using System;
 using Xamarin.Forms;
 using Tizen.System;
 
index f713c3e54284b77294a92820cc0bacb8cc776160..45278eef22da26f8ea6a9373fb6e74d388a8c606 100755 (executable)
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
 using BluetoothNetworkUtils;
 using NUnit.Framework;
 using NUnit.Framework.TUnit;
-using System;
 using Xamarin.Forms;
 using Tizen.System;
 using System.Text;