public class BluetoothLeDeviceTests
{
static BluetoothLeDevice leDevice = null;
- static bool isFound = false;
static bool isBluetoothLeSupported = false;
+ static bool isGattConnected = false;
[SetUp]
public static void Init()
BluetoothSetup.gatt_client_exit();
}
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test AddressType property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.AddressType A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task AddressType_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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;
+ }
- // TEST CODE
- if (Enum.IsDefined (typeof(BluetoothLeDeviceAddressType), leDevice.AddressType))
- Log.Info("TCT", "[TestCase][AddressType_PROPERTY] Pass : Address Type is : " + leDevice.AddressType);
- else
- Assert.Fail("[TestCase][AddressType_PROPERTY] Fail");
+ 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<BluetoothLeDeviceAddressType>(leDevice.AddressType, "[TestCase][AddressType_PROPERTY] Fail");
+ Assert.True(Enum.IsDefined(typeof(BluetoothLeDeviceAddressType), leDevice.AddressType), "[TestCase][AddressType_PROPERTY] Fail");
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
}
}
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test AdvertsingDataInformation property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.AdvertsingDataInformation A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task AdvertsingDataInformation_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
-
- byte[] advDataInfo = leDevice.AdvertsingDataInformation;
- if (advDataInfo != null && advDataInfo.Length > 0)
+ /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */
+ if (isBluetoothLeSupported == false)
{
- Assert.IsInstanceOf<int>(advDataInfo.Length, "Adv info length Should be of type integer");
- Log.Info("TCT", "[TestCase][AdvertsingDataInformation_PROPERTY] Pass : Adv Data length is : " + advDataInfo.Length);
+ BluetoothHelper.DisplayLabel("AdvertsingDataInformation_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
}
- else
+
+ if (leDevice == null)
{
- Assert.Fail("AdvertsingDataInformation byte array is not proper - FAIL");
+ 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<int>(leDevice.AdvertsingDataInformation.Length, "[TestCase][AdvertsingDataInformation_PROPERTY_READ_ONLY] Fail");
+ Assert.True(leDevice.AdvertsingDataInformation.Length > 0, "[TestCase][AdvertsingDataInformation_PROPERTY_READ_ONLY] Fail");
}
catch (NotSupportedException)
{
}
}
- public static void AppearanceTest(BluetoothLePacketType type)
- {
- leDevice.PacketType = type;
- try
- {
- int appearance = leDevice.Appearance;
- if (appearance != -1)
- {
- Assert.IsInstanceOf<int>(leDevice.Appearance);
- Log.Info("TCT", "[TestCase][Appearance_PROPERTY] Pass" + appearance);
- isFound = true;
- }
- else
- {
- Assert.Fail("[TestCase][Appearance_PROPERTY] Appearance not found in packet type : " + type);
- }
- }
- catch (Exception ex)
- {
- Log.Info("TCT", "[TestCase][Appearance_PROPERTY] Fail - No data found for Appearance" + ex);
- Assert.Fail("Le get Appearance should not throw exception " + ex.ToString());
- }
- }
-
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test Appearance property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.Appearance A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task Appearance_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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
- // Test with enum value : BluetoothLePacketType.BluetoothLeAdvertisingPacket
- AppearanceTest(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
- if (!isFound)
+ Log.Info("TCT", "[TestCase][DeviceName_PROPERTY] Packet type is set to BluetoothLeAdvertisingPacket");
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket;
+ int appearance = leDevice.Appearance;
+ if (appearance == -1)
{
- // Test with enum value : BluetoothLePacketType.BluetoothLeScanResponsePacket
- AppearanceTest(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket;
+ appearance = leDevice.Appearance;
+ if (appearance == -1)
+ {
Assert.Fail("[TestCase][Appearance_PROPERTY] Appearance not found in any packet data FAIL");
+ }
}
- isFound = false;
- }
+ Assert.IsInstanceOf<int>(leDevice.Appearance);
+ Log.Info("TCT", "[TestCase][Appearance_PROPERTY] Pass" + appearance);
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
}
}
- public static void DeviceNameTest(BluetoothLePacketType type)
- {
- leDevice.PacketType = type;
- try
- {
- string name = leDevice.DeviceName;
- if (name != null)
- {
- Assert.IsInstanceOf<string>(leDevice.DeviceName);
- Log.Info("TCT", "[TestCase][DeviceName_PROPERTY] Pass : Device name is : " + name);
- isFound = true;
- }
- else
- {
- Assert.Fail("[TestCase][DeviceName_PROPERTY] Device name not found in packet " + type);
- }
- }
- catch (Exception ex)
- {
- Log.Info("TCT", "[TestCase][DeviceName_PROPERTY] Fail - No data for device name" + ex);
- Assert.Fail("Le get device name should not throw exception " + ex.ToString());
- }
- }
-
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test DeviceName property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.DeviceName A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task DeviceName_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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");
- DeviceNameTest(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
- if (!isFound)
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket;
+ string deviceName = leDevice.DeviceName;
+ if (deviceName == null)
{
- DeviceNameTest(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
- Assert.Fail("[TestCase][DeviceName_PROPERTY] Device name not found in any packet data FAIL");
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket;
+ deviceName = leDevice.DeviceName;
+ Assert.IsNotNull(deviceName, "[TestCase][DeviceName_PROPERTY] Device name not found in any packet data FAIL");
}
- isFound = false;
- }
+ Assert.IsInstanceOf<string>(leDevice.DeviceName);
+ Log.Info("TCT", "[TestCase][DeviceName_PROPERTY] Pass : Device name is : " + deviceName);
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
}
}
- public static void TestManufacturerData(BluetoothLePacketType type)
- {
- Log.Info("TCT", "[TestCase][ManufacturerData_PROPERTY] - Packet Type is : " + type);
- leDevice.PacketType = type;
- try
- {
- ManufacturerData data = new ManufacturerData();
- data = leDevice.ManufacturerData;
- if (data != null)
- {
- 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][ManufacturerData_PROPERTY] PASS: Found Manufacturer data Id : " + data.Id + " Length : " + data.DataLength);
- isFound = true;
- }
- else
- Assert.Fail("[TestCase][ManufacturerData_PROPERTY] - No manufacturer data present in packet type : " + type);
- }
- catch (Exception ex)
- {
- Log.Info("TCT", "[TestCase][ManufacturerData_PROPERTY] - Failed with error : " + ex);
- Assert.Fail("Le get manufacturer data should not throw exception " + ex.ToString());
- }
- }
-
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test ManufacturerData property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ManufacturerData A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task ManufacturerData_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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;
+ }
- // TEST CODE
- // Test with enum value : BluetoothLePacketType.BluetoothLeAdvertisingPacket
- TestManufacturerData(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
+ if (leDevice == null)
+ {
+ leDevice = await BluetoothSetup.LeScanSetup();
+ Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ }
- if (!isFound)
+ // TEST CODE
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket;
+ ManufacturerData data = new ManufacturerData();
+ data = leDevice.ManufacturerData;
+ if (data == null)
{
- // Test with enum value : BluetoothLePacketType.BluetoothLeScanResponsePacket
- TestManufacturerData(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
- Assert.Fail("[TestCase][ManufacturerData_PROPERTY] - No manufacturer data present in either packet type : FAIL ");
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket;
+ data = leDevice.ManufacturerData;
+ Assert.IsNotNull(data, "[TestCase][DeviceName_PROPERTY] No manufacturer data present in either packet type : FAIL");
}
- isFound = false;
- }
+ 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][ManufacturerData_PROPERTY] PASS: Found Manufacturer data Id : " + data.Id + " Length : " + data.DataLength);
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
}
}
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test RemoteAddress property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.RemoteAddress A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task RemoteAddress_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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;
+ }
- // TEST CODE
- string address = leDevice.RemoteAddress;
- if (!address.Equals(null))
+ if (leDevice == null)
{
- Log.Info("TCT", "[TestCase][RemoteAddress_PROPERTY] Pass :" + address);
- Assert.IsInstanceOf<string>(leDevice.RemoteAddress, "should of type string");
+ leDevice = await BluetoothSetup.LeScanSetup();
+ Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
}
- else
- {
- Assert.Fail("[TestCase][RemoteAddress_PROPERTY] Fail");
- }
- }
+
+ // TEST CODE
+ Assert.IsNotNull(leDevice.RemoteAddress, "[TestCase][RemoteAddress_PROPERTY] Fail");
+ Assert.IsInstanceOf<string>(leDevice.RemoteAddress, "[TestCase][RemoteAddress_PROPERTY] Fail");
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
}
}
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test Rssi property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.Rssi A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task Rssi_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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<int>(leDevice.Rssi);
Log.Info("TCT", "[TestCase][Rssi_PROPERTY] Pass" + leDevice.Rssi);
- }
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
}
}
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test ScanDataInformation property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ScanDataInformation A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task ScanDataInformation_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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)
}
}
- public static void SSUidTest(BluetoothLePacketType type)
- {
- leDevice.PacketType = type;
- try
- {
- IEnumerable<string> ssuuid = leDevice.ServiceSolictationUuid;
- if (ssuuid != null)
- {
- foreach (string uuid in ssuuid)
- Log.Info("TCT", "[TestCase][ServiceSolictationUuid_PROPERTY] UUID is : " + uuid);
-
- Log.Info("TCT", "[TestCase][ServiceSolictationUuid] PASS");
- isFound = true;
- }
- else
- Assert.Fail("[TestCase][ServiceSolictationUuid_PROPERTY] FAIL OR TRY with different packet type");
- }
- catch (Exception ex)
- {
- Log.Info("TCT", "[TestCase][ServiceSolictationUuid_PROPERTY] - Failed with error : " + ex);
- Assert.Fail("Le get service solicitation uuid should not throw exception " + ex.ToString());
- }
- }
-
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test ServiceSolictationUuid property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ServiceSolictationUuid A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task ServiceSolictationUuid_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup ();
- Assert.IsNotNull (leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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
- // Test with enum value : BluetoothLePacketType.BluetoothLeAdvertisingPacket
- SSUidTest(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket;
+ IEnumerable<string> 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");
+ }
- if (!isFound)
+ foreach (string uuid in ssuuid)
{
- // Test with enum value : BluetoothLePacketType.BluetoothLeScanResponsePacket
- SSUidTest(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
- Assert.Fail("[TestCase][ServiceSolictationUuid_PROPERTY] - No SSUID data found in either packet type : FAIL ");
+ Log.Info("TCT", "[TestCase][ServiceSolictationUuid_PROPERTY] UUID is : " + uuid);
}
- isFound = false;
- }
+ Log.Info("TCT", "[TestCase][ServiceSolictationUuid] PASS");
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
}
}
- public static void UUidTest(BluetoothLePacketType type)
- {
- leDevice.PacketType = type;
- try
- {
- IEnumerable<string> svcuuid = leDevice.ServiceUuid;
- if (svcuuid != null)
- {
- foreach (string uuid in svcuuid)
- Log.Info("TCT", "[TestCase][ServiceUuid_PROPERTY] UUID is : " + uuid);
-
- Log.Info("TCT", "[TestCase][ServiceUuid_PROPERTY] PASS");
- isFound = true;
- }
- else
- Assert.Fail("[TestCase][ServiceUuid_PROPERTY]] FAIL OR TRY with different packet type");
- }
- catch (Exception ex)
- {
- Assert.Fail("LE read service uuid should not throw exception " + ex.ToString());
- }
- }
-
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test ServiceUuid property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.ServiceUuid A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task ServiceUuid_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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;
+ }
- // TEST CODE
- // Test with enum value : BluetoothLePacketType.BluetoothLeAdvertisingPacket
- UUidTest(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
+ if (leDevice == null)
+ {
+ leDevice = await BluetoothSetup.LeScanSetup();
+ Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ }
- if (!isFound)
+ // TEST CODE
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket;
+ IEnumerable<string> svcuuid = leDevice.ServiceUuid;
+ if (svcuuid == null)
{
- // Test with enum value : BluetoothLePacketType.BluetoothLeScanResponsePacket
- UUidTest(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
- Assert.Fail("[TestCase][ServiceUuid_PROPERTY] - No Service uuid data found in either packet type : FAIL ");
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket;
+ svcuuid = leDevice.ServiceUuid;
+
+ Assert.IsNotNull(svcuuid, "[TestCase][ServiceUuid_PROPERTY_READ_ONLY] No SVC UUID found in either packet type : FAIL");
}
- isFound = false;
- }
+ 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)
}
}
- public static void TxPowerLevelTest(BluetoothLePacketType type)
- {
- leDevice.PacketType = type;
- int txLevel = leDevice.TxPowerLevel;
-
- if (txLevel != -1)
- {
- Assert.IsInstanceOf<int>(leDevice.TxPowerLevel, "BluetoothLeDevice TxPowerLevel is not valid");
- Log.Info("TCT", "[TestCase][TxPowerLevel_PROPERTY] Pass - Tx Power Level is : " + txLevel);
- isFound = true;
- }
- else
- Assert.Fail("[TestCase][TxPowerLevel_PROPERTY]] FAIL OR TRY with different packet type");
- }
-
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test TxPowerLevel property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.TxPowerLevel A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task TxPowerLevel_PROPERTY_READ_ONLY()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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;
+ }
- // TEST CODE
- // Test with enum value : BluetoothLePacketType.BluetoothLeAdvertisingPacket
- TxPowerLevelTest(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
+ if (leDevice == null)
+ {
+ leDevice = await BluetoothSetup.LeScanSetup();
+ Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ }
- if (!isFound)
+ // TEST CODE
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket;
+ int txLevel = leDevice.TxPowerLevel;
+ if (txLevel == -1)
{
- // Test with enum value : BluetoothLePacketType.BluetoothLeScanResponsePacket
- TxPowerLevelTest(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket;
+ txLevel = leDevice.TxPowerLevel;
+ if (txLevel == -1)
+ {
Assert.Fail("[TestCase][TxPowerLevel_PROPERTY] - No TxPowerLevel data found in either packet type : FAIL ");
+ }
}
- isFound = false;
- }
+ Assert.IsInstanceOf<int>(leDevice.TxPowerLevel, "BluetoothLeDevice TxPowerLevel is not valid");
+ Log.Info("TCT", "[TestCase][TxPowerLevel_PROPERTY] Pass - Tx Power Level is : " + txLevel);
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
}
}
- public static void TestGetServiceData(BluetoothLePacketType type)
- {
- leDevice.PacketType = type;
- try
- {
- IEnumerable<BluetoothLeServiceData> serviceList = leDevice.GetServiceDataList();
- if (serviceList == null)
- {
- Assert.Fail("[TestCase][GetServiceDataList_RETURN_LIST] - GetServiceDataList is Empty in packet type " + type);
- }
- else
- {
- foreach (BluetoothLeServiceData data in serviceList)
- {
- Log.Info("TCT", "[TestCase][GetServiceDataList_RETURN_LIST] PASS: Retrieved service data list UUID : " + data.ServiceUuid + " length is " + data.ServiceDataLength);
- }
- isFound = true;
- }
- } catch (Exception ex)
- {
- Log.Info("TCT", "[TestCase][GetServiceDataList_RETURN_LIST] Exception caught with error : " + ex);
- Assert.Fail("Le Get ServiceData should not throw exception " + ex.ToString());
- }
- }
-
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test GetServiceDataList method of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GetServiceDataList M")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task GetServiceDataList_RETURN_LIST()
{
try
{
- isFound = false;
-
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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;
+ }
- // TEST CODE
- // Test with enum value : BluetoothLePacketType.BluetoothLeAdvertisingPacket
- TestGetServiceData(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
+ if (leDevice == null)
+ {
+ leDevice = await BluetoothSetup.LeScanSetup();
+ Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ }
- if (!isFound)
+ // TEST CODE
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeAdvertisingPacket;
+ IEnumerable<BluetoothLeServiceData> serviceList = leDevice.GetServiceDataList();
+ if (serviceList == null)
{
- // Test with enum value : BluetoothLePacketType.BluetoothLeScanResponsePacket
- TestGetServiceData(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
- Assert.Fail("[TestCase][GetServiceDataList Property] - No GetServiceDataList found in either packet type : FAIL ");
+ leDevice.PacketType = BluetoothLePacketType.BluetoothLeScanResponsePacket;
+ serviceList = leDevice.GetServiceDataList();
+
+ Assert.IsNotNull(serviceList, "[TestCase][GetServiceDataList Property] No GetServiceDataList found in either packet type : FAIL");
}
- isFound = false;
- }
+ 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)
}
}
-// [Test]
+ [Test]
[Category("P1")]
[Description("Test PacketType property of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.PacketType A")]
[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 StartAdvertising test case on another device")]
+ [Precondition(2, "Run GATT Server test case on another device")]
[Step(1, "Tap the Run button")]
[Postcondition(1, "NA")]
public static async Task PacketType_PROPERTY_READ_WRITE()
{
try
{
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
+ /* 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;
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test GattConnect method of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GattConnect M")]
[Property("CRITERIA", "MR")]
[Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")]
[Precondition(1, "Bluetooth should be turned on.")]
- [Precondition(2, "Run ReadRequested_Characteristics_CHECK_EVENT TC on the server device.")]
+ [Precondition(2, "Run GATT Server test case on another 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.")]
{
try
{
- // TEST CODE
- await BluetoothSetup.gatt_client_init();
- }
+ BluetoothGattClient client = null;
+
+ /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */
+ if (isBluetoothLeSupported == 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<GattConnectionStateChangedEventArgs> LeDevice_GattConnectionStateChanged = null;
+
+ LeDevice_GattConnectionStateChanged = (sender, e) => {
+ leDevice.GattConnectionStateChanged -= LeDevice_GattConnectionStateChanged;
+ if (e.Result == 0 && e.IsConnected == true)
+ {
+ isGattConnected = true;
+ BluetoothHelper.DisplayPassLabel("GattConnect_RETURN_VALUE");
+ }
+ else
+ {
+ BluetoothHelper.DisplayRetryLabel("GattConnect_RETURN_VALUE");
+ }
+ };
+
+ client = leDevice.GattConnect(false);
+
+ leDevice.GattConnectionStateChanged += LeDevice_GattConnectionStateChanged;
+
+ await ManualTest.WaitForConfirm();
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
catch (TypeInitializationException e)
{
if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("GattConnect_RETURN_VALUE");
await ManualTest.WaitForConfirm();
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test GattDisconnect method of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GattDisconnect M")]
[Property("CRITERIA", "MR")]
[Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")]
[Precondition(1, "Bluetooth should be turned on.")]
- [Precondition(2, "Run ReadRequested_Characteristics_CHECK_EVENT TC on the server device.")]
+ [Precondition(2, "Run GATT Server test case on another 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.")]
{
try
{
- await BluetoothSetup.gatt_client_init();
+ BluetoothGattClient client = null;
- BluetoothSetup.leDevice.GattDisconnect();
- await Task.Delay(10000);
- Assert.IsTrue(!BluetoothSetup.StateChanged_flag, "GattConnectionStateChanged callback is not invoked for Disconnect");
- }
+ /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */
+ if (isBluetoothLeSupported == 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");
+ }
+
+ if (isGattConnected == false)
+ {
+ leDevice.GattConnect(false);
+ await Task.Delay(2000);
+ }
+
+ EventHandler<GattConnectionStateChangedEventArgs> LeDevice_GattConnectionStateChanged = null;
+
+ LeDevice_GattConnectionStateChanged = (sender, e) => {
+ leDevice.GattConnectionStateChanged -= LeDevice_GattConnectionStateChanged;
+ if (e.Result == 0 && e.IsConnected == false)
+ {
+ isGattConnected = false;
+ BluetoothHelper.DisplayPassLabel("GattDisconnect_RETURN_VALUE");
+ }
+ };
+
+ leDevice.GattDisconnect();
+
+ leDevice.GattConnectionStateChanged += LeDevice_GattConnectionStateChanged;
+
+ await ManualTest.WaitForConfirm();
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
catch (TypeInitializationException e)
{
if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("GattDisconnect_RETURN_VALUE");
await ManualTest.WaitForConfirm();
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test GattConnectionStateChanged event of BluetoothLeDevice")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeDevice.GattConnectionStateChanged E")]
[Property("CRITERIA", "EVL")]
[Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")]
[Precondition(1, "Bluetooth should be turned on.")]
- [Precondition(2, "Run ReadRequested_Characteristics_CHECK_EVENT TC on the server device.")]
+ [Precondition(2, "Run GATT Server test case on another 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.")]
{
try
{
- await BluetoothSetup.gatt_client_init();
- }
+ BluetoothGattClient client = null;
+
+ /* We can't occupy the precondition, if BT LE feature is not supported in Manual TC */
+ if (isBluetoothLeSupported == 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<GattConnectionStateChangedEventArgs> LeDevice_GattConnectionStateChanged = null;
+
+ LeDevice_GattConnectionStateChanged = (sender, e) => {
+ leDevice.GattConnectionStateChanged -= LeDevice_GattConnectionStateChanged;
+ if (e.Result == 0)
+ {
+ isGattConnected = e.IsConnected;
+ BluetoothHelper.DisplayPassLabel("GattConnectionStateChanged_CHECK_EVENT");
+ }
+ };
+
+ if (isGattConnected == true)
+ {
+ leDevice.GattDisconnect();
+ }
+ else
+ {
+ client = leDevice.GattConnect(false);
+ }
+
+ leDevice.GattConnectionStateChanged += LeDevice_GattConnectionStateChanged;
+
+ await ManualTest.WaitForConfirm();
+ }
catch (NotSupportedException)
{
if (isBluetoothLeSupported == false)
catch (TypeInitializationException e)
{
if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("GattConnectionStateChanged_CHECK_EVENT");
await ManualTest.WaitForConfirm();
}
{
Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
}
+ finally
+ {
+ if (leDevice != null && isGattConnected == true)
+ {
+ leDevice.GattDisconnect();
+ await Task.Delay(2000);
+ isGattConnected = false;
+ }
+ }
}
}
}