From: DoHyun Pyun Date: Tue, 29 Dec 2020 05:55:52 +0000 (+0900) Subject: [Bluetooth][Manual][Non-ACR] Make combine TC for Adapter X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a54c593a9f0bac036b80d06282ff06b8af5ab894;p=test%2Ftct%2Fcsharp%2Fapi.git [Bluetooth][Manual][Non-ACR] Make combine TC for Adapter Change-Id: If1e7394c3a768b4adb31d90172b5a58cf734e1ca Signed-off-by: DoHyun Pyun --- diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAdapter.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAdapter.cs deleted file mode 100644 index 72f6d97..0000000 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAdapter.cs +++ /dev/null @@ -1,744 +0,0 @@ -using System; -using System.Threading.Tasks; -using System.Linq; -using System.Collections.Generic; -using BluetoothNetworkUtils; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Tizen.System; -using Xamarin.Forms; - -namespace Tizen.Network.Bluetooth.Tests -{ - [TestFixture] - [Description("BluetoothAdapter Tests")] - public class BluetoothAdapterTests - { - private static string NewName = "TizenModified"; - static string address; - static BluetoothLeDevice leDevice = null; - static bool isBluetoothSupported = false; - static bool isBluetoothLeSupported = false; - - [SetUp] - public static void Init() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported); - Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le", out isBluetoothLeSupported); - } - [TearDown] - public static void Destroy() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); - } - - public static void EventHandlerNameChanged(object sender, NameChangedEventArgs e) - { - Log.Debug(Globals.LogTag, "New device name = " + e.DeviceName); - ManualTest.Confirm(); - } - - [Test] - [Category("P1")] - [Description("Check whether Name property of BtAdapter is writable.")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.Name A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static async Task Name_PROPERTY_GET_SET() - { - try - { - //PRECONDITION - string originalName = BluetoothAdapter.Name; - BluetoothAdapter.NameChanged += EventHandlerNameChanged; - - //TEST CODE - BluetoothAdapter.Name = NewName; - await ManualTest.WaitForConfirm(); - - //POSTCONDITION - BluetoothAdapter.NameChanged -= EventHandlerNameChanged; - BluetoothAdapter.Name = originalName; - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("Name_PROPERTY_GET_SET"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Name_PROPERTY_GET_SET"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - public static void VisibilityModeChangedEvent(object sender, VisibilityModeChangedEventArgs e) - { - Log.Debug(Globals.LogTag, "Current visibility mode: " + e.Visibility); - ManualTest.Confirm(); - } - -// [Test] - [Category("P1")] - [Description("Test RemainingTimeAsVisible property of BtAdapter")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.RemainingTimeAsVisible 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, "Set Visibility timeout to some value given in minutes or hour.")] - [Step(1, "Tap the Run button")] - [Postcondition(2, "Go to Bluetooth in Settings and set Visibility timeout to Always on")] - public static void RemainingTimeAsVisible_READ_ONLY() - { - try - { - BluetoothHelper.LaunchVisiblityAppControl("10"); - - Task.Delay(5000).Wait(); - - // PRECONDITION - VisibilityMode mode = BluetoothAdapter.Visibility; - - // TEST CODE - if (mode == VisibilityMode.TimeLimitedDiscoverable) - { - int time = BluetoothAdapter.RemainingTimeAsVisible; - if(time > 0) - Log.Debug ("TCT", "[TestCase][RemainingTimeAsVisible][READ_ONLY] Pass"); - else - Assert.Fail("Visibility timeout value is not set as per the given precondition"); - } - else - { - Assert.Fail("Visibility timeout value is not set as per the given precondition"); - } - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("RemainingTimeAsVisible_READ_ONLY"); - ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("RemainingTimeAsVisible_READ_ONLY"); - ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - public static void EventHandlerStateChanged(object sender, StateChangedEventArgs e) - { - Assert.IsTrue((int)e.Result == 0, "StateChanged event is not working properly"); - ManualTest.Confirm(); - } - - [Test] - [Category("P1")] - [Description("Listen StateChanged event of BtAdapter when BT is turned off")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.StateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Step(1, "Tap the Run button")] - [Step(2, "Turn off the bluetooth (If BT on/off UI exists, then click it. But BT on/off UI does not exist, we should use BT test tool to on / off BT.")] - [Postcondition(1, "Turn on the bluetooth")] - public static async Task StateChanged_CHECK_EVENT_BT_OFF() - { - try - { - // PRECONDITION - bool isEnabled = BluetoothAdapter.IsBluetoothEnabled; - Log.Debug(Globals.LogTag, "Current BT status: " + isEnabled); - - // TEST CODE - BluetoothAdapter.StateChanged += EventHandlerStateChanged; - await ManualTest.WaitForConfirm(); - - // POSTCONDITION - BluetoothAdapter.StateChanged -= EventHandlerStateChanged; - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("StateChanged_CHECK_EVENT_BT_OFF"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("StateChanged_CHECK_EVENT_BT_OFF"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Listen StateChanged event of BtAdapter when BT is turned on")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.StateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Turn off the bluetooth")] - [Step(1, "Tap the Run button")] - [Step(2, "Turn on the bluetooth (If BT on/off UI exists, then click it. But BT on/off UI does not exist, we should use BT test tool to on / off BT.")] - [Postcondition(1, "NA")] - public static async Task StateChanged_CHECK_EVENT_BT_ON() - { - try - { - // PRECONDITION - bool isEnabled = BluetoothAdapter.IsBluetoothEnabled; - Log.Debug(Globals.LogTag, "Current BT status: " + isEnabled); - - // TEST CODE - BluetoothAdapter.StateChanged += EventHandlerStateChanged; - await ManualTest.WaitForConfirm(); - - // POSTCONDITION - BluetoothAdapter.StateChanged -= EventHandlerStateChanged; - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("StateChanged_CHECK_EVENT_BT_ON"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("StateChanged_CHECK_EVENT_BT_ON"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - public static void EventHandlerVisibilityModeChanged(object sender, VisibilityModeChangedEventArgs e) - { - Assert.IsTrue((int)e.Result == 0, "VisibilityModeChanged event is not working properly"); - ManualTest.Confirm(); - } - -// [Test] - [Category("P1")] - [Description("Listen VisibilityModeChanged event of BtAdapter")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.VisibilityModeChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Step(1, "Tap the Run button")] - [Step(2, "Go to Bluetooth in Settings and change Visibility timeout value")] - [Postcondition(1, "NA")] - public static async Task VisibilityModeChanged_CHECK_EVENT() - { - try - { - BluetoothAdapter.VisibilityModeChanged += EventHandlerVisibilityModeChanged; - - BluetoothHelper.LaunchVisiblityAppControl("10"); - - // TEST CODE - await ManualTest.WaitForConfirm(); - - // POSTCONDITION - BluetoothAdapter.VisibilityModeChanged -= EventHandlerVisibilityModeChanged; - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("VisibilityModeChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("VisibilityModeChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - public static void EventHandlerVisibilityDurationChanged(object sender, VisibilityDurationChangedEventArgs e) - { - Assert.IsTrue(e.Duration > 0, "VisibilityDurationChanged event is not working properly"); - ManualTest.Confirm(); - } - -// [Test] - [Category("P1")] - [Description("Listen VisibilityDurationChanged event of BtAdapter")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.VisibilityDurationChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Go to Bluetooth in Settings and change Visibility timeout to a value in minutes or hour")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "Set Visibility timeout to Always on")] - public static async Task VisibilityDurationChanged_CHECK_EVENT() - { - try - { - BluetoothHelper.LaunchVisiblityAppControl("10"); - - await Task.Delay(5000); - - // PRECONDITION - VisibilityMode mode = BluetoothAdapter.Visibility; - - //TEST CODE - if (mode == VisibilityMode.TimeLimitedDiscoverable) - { - BluetoothAdapter.VisibilityDurationChanged += EventHandlerVisibilityDurationChanged; - await ManualTest.WaitForConfirm(); - - // POSTCONDITION - BluetoothAdapter.VisibilityDurationChanged -= EventHandlerVisibilityDurationChanged; - } - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("VisibilityDurationChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("VisibilityDurationChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Reads VisibilityMode value of BtAdapter")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.Visibility A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static void Visibility_READ_ONLY() - { - try - { - VisibilityMode mode = BluetoothAdapter.Visibility; - - //TEST CODE - if (mode >= VisibilityMode.NonDiscoverable && mode <= VisibilityMode.TimeLimitedDiscoverable) - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Visibility Mode" + mode); - else - Assert.Fail("Failed to intialize Bluetooth"); - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("VisibilityMode_READ_ONLY"); - ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("VisibilityMode_READ_ONLY"); - ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - public static void BondedDeviceTest(BluetoothDevice item) - { - if(item.Address!=null && item.Name != null && item.IsPaired && item.ServiceUuidList!=null) - Log.Debug ("TCT", "[TestCase][GetBondedDevices] Pass"); - } - - [Test] - [Category("P1")] - [Description("List all bonded bluetooth devices")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.GetBondedDevices 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, "Pair with atleast one nearby bluetooth device")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static void GetBondedDevices_RETURN_LIST_OF_DEVICES() - { - try - { - //TEST CODE - IEnumerable list = BluetoothAdapter.GetBondedDevices (); - if (!list.Any ()) - Assert.Fail("No bonded devices are found."); - else - { - foreach (BluetoothDevice item in list) - { - BondedDeviceTest(item); - } - } - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("GetBondedDevices_RETURN_LIST_OF_DEVICES"); - ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetBondedDevices_RETURN_LIST_OF_DEVICES"); - ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Get bonded bluetooth device by address")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.GetBondedDevice 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, "Pair with atleast one nearby bluetooth device")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static void GetBondedDevice_RETURN_BONDED_DEVICE() - { - try - { - IEnumerable list = BluetoothAdapter.GetBondedDevices(); - if (!list.Any()) - Assert.Fail("No bonded devices are found."); - else - { - var item = list.ElementAt(0); - address = item.Address; - BluetoothDevice device = BluetoothAdapter.GetBondedDevice(address); - Assert.IsNotNull(device, "Bonded device object should not be null"); - BondedDeviceTest(device); - } - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("GetBondedDevice_RETURN_BONDED_DEVICE"); - ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("GetBondedDevice_RETURN_BONDED_DEVICE"); - ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Return type of CreateServerSocket.")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.CreateServerSocket M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Adhavan, adhavan.m@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Run this only on test device which acts as server")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static void CreateServerSocket_RETURN_TYPE() - { - //TEST CODE - try - { - BluetoothSetup.CreateServerSocketUtil(); - Assert.IsNotNull(BluetoothSetup.Server, "[TestCase][CreateServerSocket][Socket] Failed"); - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("CreateServerSocket_RETURN_TYPE"); - ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("CreateServerSocket_RETURN_TYPE"); - ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Destroys the server socket")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.DestroyServerSocket M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MMB")] - [Property("AUTHOR", "Adhavan, adhavan.m@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Run this only on test device which acts as server")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static void DestroyServerSocket_DESTROY_SOCKET_TEST() - { - //TEST CODE - try - { - BluetoothSetup.CreateServerSocketUtil(); - BluetoothSetup.DestroyServerSocketUtil(); - Assert.IsNull(BluetoothSetup.Server, "[TestCase][DestroyServerSocket][Socket] Failed"); - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("Name_PROPERTY_GET_SET"); - ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Name_PROPERTY_GET_SET"); - ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - -// [Test] - [Category("P1")] - [Description("Scan all avaiable LE devices")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.StartLeScan M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MCST")] - [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")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static async Task StartLeScan_CHECK_STATUS_LE_SCAN() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Start Le Scan Operation "); - - try - { - // PRECONDITION: - // 1. Open Bluetooth in Settings on test device and turn on Bluetooth - // 2. Run StartAdvertising test case on another device - - //TEST CODE - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "[TestCase][StartLeScan] Failed to find Le device"); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("StartLeScan_CHECK_STATUS_LE_SCAN"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("StartLeScan_CHECK_STATUS_LE_SCAN"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - -// [Test] - [Category("P1")] - [Description("Stop scan operation")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.StopLeScan 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 StartAdvertising test case on another device")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static async Task StopLeScan_RETURN_STOP_LE_SCAN() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "StopLeScan Operation"); - - try - { - // PRECONDITION: - // 1. Open Bluetooth in Settings on test device and turn on Bluetooth - // 2. Run StartAdvertising test case on another device - // 3. Open terminal to view logs - // 4. Enter command "sdb dlog -c" to clear log - // 5. Enter command "sdb dlog | grep TCT" to terminal - - BluetoothAdapter.StartLeScan(); - await Task.Delay(5000); - - //TEST CODE - BluetoothAdapter.StopLeScan(); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("StopLeScan_RETURN_STOP_LE_SCAN"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("StopLeScan_RETURN_STOP_LE_SCAN"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - -// [Test] - [Category("P1")] - [Description("Check ScanResultChanged event")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.ScanResultChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [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")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public static async Task ScanResultChanged_CHECK_EVENT() - { - try - { - // PRECONDITION: - // 1. Open Bluetooth in Settings on test device and turn on Bluetooth - // 2. Run StartAdvertising test case on another device - - //TEST CODE - leDevice = await BluetoothSetup.LeScanSetup(); - Assert.IsNotNull(leDevice, "[TestCase][StartLeScan] Failed to find Le device"); - } - catch (NotSupportedException) - { - if (isBluetoothLeSupported == false) - { - BluetoothHelper.DisplayLabel("ScanResultChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("ScanResultChanged_CHECK_EVENT"); - 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/TSBluetoothCombine6_Adapter.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine6_Adapter.cs new file mode 100644 index 0000000..4ee775d --- /dev/null +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine6_Adapter.cs @@ -0,0 +1,558 @@ +using System; +using System.Threading.Tasks; +using System.Linq; +using System.Collections.Generic; +using BluetoothNetworkUtils; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.System; +using Xamarin.Forms; + +namespace Tizen.Network.Bluetooth.Tests +{ + [TestFixture] + [Description("BluetoothAdapter Tests")] + public class BluetoothAdapterTests + { + static bool isBluetoothSupported = false; + + /* PASS flag Variaibles for TCs */ + static bool pass_Name_PROPERTY_GET_SET = false; + static bool pass_BTState_GET_ENUM_ALL = false; + static bool pass_StateChanged_CHECK_EVENT_BT_OFF = false; + static bool pass_StateChanged_CHECK_EVENT_BT_ON = false; + static bool pass_Result_StateChanged_READ_ONLY = false; + static bool pass_Visibility_READ_ONLY = false; + static bool pass_Duration_VisibilityModeChanged_READ_ONLY = false; + static bool pass_Result_VisibilityModeChanged_READ_ONLY = false; + static bool pass_Visibility_VisibilityModeChanged_READ_ONLY = false; + static bool pass_GetBondedDevices_RETURN_LIST_OF_DEVICES = false; + static bool pass_GetBondedDevice_RETURN_BONDED_DEVICE = false; + static bool pass_CreateServerSocket_RETURN_TYPE = false; + static bool pass_DestroyServerSocket_DESTROY_SOCKET_TEST = false; + + [SetUp] + public static void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported); + } + [TearDown] + public static void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); + } + + public async Task AdapterCombine_TEST() + { + EventHandler EventHandlerStateChanged = null; + + try + { + string NewName = "TizenModified"; + string originalName = BluetoothAdapter.Name; + + EventHandler EventHandlerNameChanged = null; + + EventHandlerNameChanged = (sender, e) => + { + /* PASS condition for pass_Name_PROPERTY_GET_SET */ + Assert.IsInstanceOf(e.DeviceName, "DeviceName value is not of type string"); + pass_Name_PROPERTY_GET_SET = true; + + BluetoothAdapter.NameChanged -= EventHandlerNameChanged; + BluetoothAdapter.Name = originalName; + }; + + BluetoothAdapter.NameChanged += EventHandlerNameChanged; + BluetoothAdapter.Name = NewName; + await Task.Delay(1000); + + VisibilityMode mode = BluetoothAdapter.Visibility; + + /* PASS condition for pass_Visibility_READ_ONLY */ + if (mode >= VisibilityMode.NonDiscoverable && mode <= VisibilityMode.TimeLimitedDiscoverable) + LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Visibility Mode" + mode); + else + Assert.Fail("Failed to intialize Bluetooth"); + + pass_Visibility_READ_ONLY = true; + + /* PASS condition for GetBondedDevices_RETURN_LIST_OF_DEVICES */ + IEnumerable list = BluetoothAdapter.GetBondedDevices(); + + if (!list.Any()) + { + Assert.Fail("No bonded devices are found."); + } + else + { + string address; + + pass_GetBondedDevices_RETURN_LIST_OF_DEVICES = true; + + var item = list.ElementAt(0); + address = item.Address; + + /* PASS condition for GetBondedDevice_RETURN_BONDED_DEVICE */ + BluetoothDevice device = BluetoothAdapter.GetBondedDevice(address); + Assert.IsNotNull(device, "Bonded device object should not be null"); + pass_GetBondedDevice_RETURN_BONDED_DEVICE = true; + } + + BluetoothServerSocket server = null; + string serviceUuid = "00001101-0000-1000-8000-00805F9B7777"; + + /* PASS condition for CreateServerSocket_RETURN_TYPE */ + server = BluetoothAdapter.CreateServerSocket(serviceUuid); + pass_CreateServerSocket_RETURN_TYPE = true; + + /* PASS condition for DestroyServerSocket_DESTROY_SOCKET_TEST */ + BluetoothAdapter.DestroyServerSocket(server); + pass_DestroyServerSocket_DESTROY_SOCKET_TEST = true; + + EventHandler EventHandlerVisibilityDurationChanged = null; + + EventHandlerVisibilityDurationChanged = (sender, e) => { + /* PASS condition for Duration_VisibilityModeChanged_READ_ONLY */ + Assert.IsInstanceOf(e.Duration, "duration parameter should be of type int"); + pass_Duration_VisibilityModeChanged_READ_ONLY = true; + + if (pass_Duration_VisibilityModeChanged_READ_ONLY == true && + pass_Result_VisibilityModeChanged_READ_ONLY == true && + pass_Visibility_VisibilityModeChanged_READ_ONLY == true && + pass_Result_StateChanged_READ_ONLY == true && + pass_BTState_GET_ENUM_ALL == true && + pass_StateChanged_CHECK_EVENT_BT_OFF == true && + pass_StateChanged_CHECK_EVENT_BT_ON == true) + BluetoothHelper.DisplayPassLabel("AdapterCombine_TEST"); + + BluetoothAdapter.VisibilityDurationChanged -= EventHandlerVisibilityDurationChanged; + }; + + BluetoothAdapter.VisibilityDurationChanged += EventHandlerVisibilityDurationChanged; + + EventHandler EventHandlerVisibilityModeChanged = null; + + EventHandlerVisibilityModeChanged = (sender, e) => { + /* PASS condition for Result_VisibilityModeChanged_READ_ONLY */ + Assert.IsInstanceOf(e.Result, "Result value is not of type int"); + pass_Result_VisibilityModeChanged_READ_ONLY = true; + + /* PASS condition for Visibility_VisibilityModeChanged_READ_ONLY */ + Assert.IsInstanceOf(e.Visibility, "Visibility parameter should be of type VisibilityMode"); + pass_Visibility_VisibilityModeChanged_READ_ONLY = true; + + if (pass_Duration_VisibilityModeChanged_READ_ONLY == true && + pass_Result_VisibilityModeChanged_READ_ONLY == true && + pass_Visibility_VisibilityModeChanged_READ_ONLY == true && + pass_Result_StateChanged_READ_ONLY == true && + pass_BTState_GET_ENUM_ALL == true && + pass_StateChanged_CHECK_EVENT_BT_OFF == true && + pass_StateChanged_CHECK_EVENT_BT_ON == true) + BluetoothHelper.DisplayPassLabel("AdapterCombine_TEST"); + + BluetoothAdapter.VisibilityModeChanged -= EventHandlerVisibilityModeChanged; + }; + + BluetoothAdapter.VisibilityModeChanged += EventHandlerVisibilityModeChanged; + + bool isEnabled = BluetoothAdapter.IsBluetoothEnabled; + + EventHandlerStateChanged = (sender, e) => { + /* PASS condition for Result_StateChanged_READ_ONLY */ + Assert.IsInstanceOf(e.Result, "Result value is not of type int"); + pass_Result_StateChanged_READ_ONLY = true; + + /* PASS condition for BTState_GET_ENUM_ALL */ + Assert.IsInstanceOf(e.BTState, "BTState is not of type BluetoothState"); + pass_BTState_GET_ENUM_ALL = true; + + /* PASS condition for StateChanged_CHECK_EVENT_BT_OFF */ + if (e.BTState == 0) + pass_StateChanged_CHECK_EVENT_BT_OFF = true; + + /* PASS condition for StateChanged_CHECK_EVENT_BT_ON */ + if (e.BTState != 0) + pass_StateChanged_CHECK_EVENT_BT_ON = true; + + if (pass_Duration_VisibilityModeChanged_READ_ONLY == true && + pass_Result_VisibilityModeChanged_READ_ONLY == true && + pass_Visibility_VisibilityModeChanged_READ_ONLY == true && + pass_Result_StateChanged_READ_ONLY == true && + pass_BTState_GET_ENUM_ALL == true && + pass_StateChanged_CHECK_EVENT_BT_OFF == true && + pass_StateChanged_CHECK_EVENT_BT_ON == true) + BluetoothHelper.DisplayPassLabel("AdapterCombine_TEST"); + }; + + BluetoothAdapter.StateChanged += EventHandlerStateChanged; + + await ManualTest.WaitForConfirm(); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + BluetoothAdapter.StateChanged -= EventHandlerStateChanged; + } + } + + [Test] + [Category("P1")] + [Description("Check whether Name property of BtAdapter is writable.")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.Name A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task Name_PROPERTY_GET_SET() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("Name_PROPERTY_GET_SET"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Name_PROPERTY_GET_SET == false) + await AdapterCombine_TEST(); + + Assert.True(pass_Name_PROPERTY_GET_SET, "[TestCase][Name_PROPERTY_GET_SET] Fail"); + } + + [Test] + [Category("P1")] + [Description("Reads VisibilityMode value of BtAdapter")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.Visibility A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task Visibility_READ_ONLY() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("Visibility_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Visibility_READ_ONLY == false) + await AdapterCombine_TEST(); + + Assert.True(pass_Visibility_READ_ONLY, "[TestCase][Visibility_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test Duration. Check if Duration has proper value")] + [Property("SPEC", "Tizen.Network.Bluetooth.VisibilityDurationChangedEventArgs.Duration A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Run next command in the linux shell.\n>sdb shell dbus-send --system --type=signal /org/projectx/bt/adapter org.projectx.bt_event.DiscoverableTimeoutChanged int32:0 int16:0")] + [Step(3, "(Because there is no UX senario or entry point to set the visiable timeout, so we should generate the event using command line to pass this TCT")] + [Postcondition(1, "NA")] + public async Task Duration_VisibilityModeChanged_READ_ONLY() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("Duration_VisibilityModeChanged_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Duration_VisibilityModeChanged_READ_ONLY == false) + await AdapterCombine_TEST(); + + Assert.True(pass_Duration_VisibilityModeChanged_READ_ONLY, "[TestCase][Duration_VisibilityModeChanged_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test Result. Check if Result has proper value")] + [Property("SPEC", "Tizen.Network.Bluetooth.VisibilityModeChangedEventArgs.Result A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Run next command in the linux shell.\n>sdb shell dbus-send --system --type=signal /org/projectx/bt/adapter org.projectx.bt_event.DiscoverableModeChanged int32:0 int16:1")] + [Step(3, "(Because there is no UX senario or entry point to set the visiable mode change, so we should generate the event using command line to pass this TCT")] + [Postcondition(1, "NA")] + public async Task Result_VisibilityModeChanged_READ_ONLY() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("Result_VisibilityModeChanged_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Result_VisibilityModeChanged_READ_ONLY == false) + await AdapterCombine_TEST(); + + Assert.True(pass_Result_VisibilityModeChanged_READ_ONLY, "[TestCase][Result_VisibilityModeChanged_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test Visibility. Check if the Visibility has correct value")] + [Property("SPEC", "Tizen.Network.Bluetooth.VisibilityModeChangedEventArgs.Visibility A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Run next command in the linux shell.\n>sdb shell dbus-send --system --type=signal /org/projectx/bt/adapter org.projectx.bt_event.DiscoverableModeChanged int32:0 int16:1")] + [Step(3, "(Because there is no UX senario or entry point to set the visiable mode change, so we should generate the event using command line to pass this TCT")] + [Postcondition(1, "NA")] + public async Task Visibility_VisibilityModeChanged_READ_ONLY() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("Visibility_VisibilityModeChanged_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Visibility_VisibilityModeChanged_READ_ONLY == false) + await AdapterCombine_TEST(); + + Assert.True(pass_Visibility_VisibilityModeChanged_READ_ONLY, "[TestCase][Visibility_VisibilityModeChanged_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("List all bonded bluetooth devices")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.GetBondedDevices 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, "Pair with atleast one nearby bluetooth device")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task GetBondedDevices_RETURN_LIST_OF_DEVICES() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("GetBondedDevices_RETURN_LIST_OF_DEVICES"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetBondedDevices_RETURN_LIST_OF_DEVICES == false) + await AdapterCombine_TEST(); + + Assert.True(pass_GetBondedDevices_RETURN_LIST_OF_DEVICES, "[TestCase][GetBondedDevices_RETURN_LIST_OF_DEVICES] Fail"); + } + + [Test] + [Category("P1")] + [Description("Get bonded bluetooth device by address")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.GetBondedDevice 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, "Pair with atleast one nearby bluetooth device")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task GetBondedDevice_RETURN_BONDED_DEVICE() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("GetBondedDevice_RETURN_BONDED_DEVICE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetBondedDevice_RETURN_BONDED_DEVICE == false) + await AdapterCombine_TEST(); + + Assert.True(pass_GetBondedDevice_RETURN_BONDED_DEVICE, "[TestCase][GetBondedDevice_RETURN_BONDED_DEVICE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Return type of CreateServerSocket.")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.CreateServerSocket M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Adhavan, adhavan.m@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Run this only on test device which acts as server")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task CreateServerSocket_RETURN_TYPE() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("CreateServerSocket_RETURN_TYPE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_CreateServerSocket_RETURN_TYPE == false) + await AdapterCombine_TEST(); + + Assert.True(pass_CreateServerSocket_RETURN_TYPE, "[TestCase][CreateServerSocket_RETURN_TYPE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Destroys the server socket")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.DestroyServerSocket M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MMB")] + [Property("AUTHOR", "Adhavan, adhavan.m@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Run this only on test device which acts as server")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task DestroyServerSocket_DESTROY_SOCKET_TEST() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("DestroyServerSocket_DESTROY_SOCKET_TEST"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_DestroyServerSocket_DESTROY_SOCKET_TEST == false) + await AdapterCombine_TEST(); + + Assert.True(pass_DestroyServerSocket_DESTROY_SOCKET_TEST, "[TestCase][DestroyServerSocket_DESTROY_SOCKET_TEST] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test BTState. Check if BTState has correct value")] + [Property("SPEC", "Tizen.Network.Bluetooth.StateChangedEventArgs.BTState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRE")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Tap the Run button")] + [Step(2, "Turn on or off the bluetooth (If BT on/off UI exists, then click it. But BT on/off UI does not exist, we should use BT test tool to on / off BT.")] + [Postcondition(1, "Turn on the bluetooth")] + public async Task BTState_GET_ENUM_ALL() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("BTState_GET_ENUM_ALL"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_BTState_GET_ENUM_ALL == false) + await AdapterCombine_TEST(); + + Assert.True(pass_BTState_GET_ENUM_ALL, "[TestCase][BTState_GET_ENUM_ALL] Fail"); + } + + [Test] + [Category("P1")] + [Description("Listen StateChanged event of BtAdapter when BT is turned off")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.StateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Step(1, "Tap the Run button")] + [Step(2, "Turn off the bluetooth (If BT on/off UI exists, then click it. But BT on/off UI does not exist, we should use BT test tool to on / off BT.")] + [Postcondition(1, "Turn on the bluetooth")] + public async Task StateChanged_CHECK_EVENT_BT_OFF() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("StateChanged_CHECK_EVENT_BT_OFF"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_StateChanged_CHECK_EVENT_BT_OFF == false) + await AdapterCombine_TEST(); + + Assert.True(pass_StateChanged_CHECK_EVENT_BT_OFF, "[TestCase][StateChanged_CHECK_EVENT_BT_OFF] Fail"); + } + + [Test] + [Category("P1")] + [Description("Listen StateChanged event of BtAdapter when BT is turned on")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.StateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "Turn off the bluetooth")] + [Step(1, "Tap the Run button")] + [Step(2, "Turn on the bluetooth (If BT on/off UI exists, then click it. But BT on/off UI does not exist, we should use BT test tool to on / off BT.")] + [Postcondition(1, "NA")] + public async Task StateChanged_CHECK_EVENT_BT_ON() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("StateChanged_CHECK_EVENT_BT_ON"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_StateChanged_CHECK_EVENT_BT_ON == false) + await AdapterCombine_TEST(); + + Assert.True(pass_StateChanged_CHECK_EVENT_BT_ON, "[TestCase][StateChanged_CHECK_EVENT_BT_ON] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test Result. Check if Result has proper value")] + [Property("SPEC", "Tizen.Network.Bluetooth.StateChangedEventArgs.Result A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] + [Precondition(1, "NA")] + [Step(1, "Tap the Run button")] + [Step(2, "Turn on or off the bluetooth (If BT on/off UI exists, then click it. But BT on/off UI does not exist, we should use BT test tool to on / off BT.")] + [Postcondition(1, "Turn on the bluetooth")] + public async Task Result_StateChanged_READ_ONLY() + { + /* We can't occupy the precondition, if Bluetooth feature is not supported in Manual TC */ + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("Result_StateChanged_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Result_StateChanged_READ_ONLY == false) + await AdapterCombine_TEST(); + + Assert.True(pass_Result_StateChanged_READ_ONLY, "[TestCase][Result_StateChanged_READ_ONLY] Fail"); + } + } +} diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSStateChangedEventArgs.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSStateChangedEventArgs.cs deleted file mode 100755 index fbff0f7..0000000 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSStateChangedEventArgs.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using System.Threading.Tasks; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Tizen.System; -using Xamarin.Forms; - -namespace Tizen.Network.Bluetooth.Tests -{ - [TestFixture] - [Description("StateChangedEventArgs Tests")] - public class StateChangedEventArgsTests - { - static bool isBluetoothSupported = false; - - [SetUp] - public static void Init() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported); - } - [TearDown] - public static void Destroy() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); - } - - public static void EventHandlerStateChanged(object sender, StateChangedEventArgs e) - { - if (e.Result == BluetoothError.None) - { - Log.Debug("TCT", "[TestCase][StateChanged][Result_READ_ONLY] Pass"); - BluetoothHelper.DisplayPassLabel("Result_READ_ONLY"); - } - if (e.BTState == BluetoothState.Disabled) - { - Log.Debug("TCT", "[TestCase][StateChanged][BTState_READ_ONLY][Disabled] Pass"); - BluetoothHelper.DisplayPassLabel("BTState_READ_ONLY"); - } - if (e.BTState == BluetoothState.Enabled) - { - Log.Debug("TCT", "[TestCase][StateChanged][BTState_READ_ONLY][Enabled] Pass"); - BluetoothHelper.DisplayPassLabel("BTState_READ_ONLY"); - } - } - - [Test] - [Category("P1")] - [Description("Test Result. Check if Result has proper value")] - [Property("SPEC", "Tizen.Network.Bluetooth.StateChangedEventArgs.Result A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "NA")] - [Step(1, "Tap the Run button")] - [Step(2, "Turn on or off the bluetooth (If BT on/off UI exists, then click it. But BT on/off UI does not exist, we should use BT test tool to on / off BT.")] - [Postcondition(1, "Turn on the bluetooth")] - public static async Task Result_READ_ONLY() - { - try - { - // PRECONDITION - bool isEnabled = BluetoothAdapter.IsBluetoothEnabled; - Log.Debug("TCT", "Current BT status: " + isEnabled); - - BluetoothAdapter.StateChanged += EventHandlerStateChanged; - await ManualTest.WaitForConfirm(); - BluetoothAdapter.StateChanged -= EventHandlerStateChanged; - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("Name_PROPERTY_GET_SET"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Name_PROPERTY_GET_SET"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test BTState. Check if BTState has correct value")] - [Property("SPEC", "Tizen.Network.Bluetooth.StateChangedEventArgs.BTState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRE")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "NA")] - [Step(1, "Tap the Run button")] - [Step(2, "Turn on or off the bluetooth (If BT on/off UI exists, then click it. But BT on/off UI does not exist, we should use BT test tool to on / off BT.")] - [Postcondition(1, "Turn on the bluetooth")] - public static async Task BTState_GET_ENUM_ALL() - { - try - { - // PRECONDITION - bool isEnabled = BluetoothAdapter.IsBluetoothEnabled; - Log.Debug("TCT", "Current BT status: " + isEnabled); - - BluetoothAdapter.StateChanged += EventHandlerStateChanged; - await ManualTest.WaitForConfirm(); - BluetoothAdapter.StateChanged -= EventHandlerStateChanged; - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("Name_PROPERTY_GET_SET"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Name_PROPERTY_GET_SET"); - 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/TSVisibilityDurationChangedEventArgs.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSVisibilityDurationChangedEventArgs.cs deleted file mode 100755 index bfffc2a..0000000 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSVisibilityDurationChangedEventArgs.cs +++ /dev/null @@ -1,87 +0,0 @@ -// The Below code shall be enabled when UI restriction for setting the visibility parameters is fixed -using System; -using System.Threading.Tasks; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Tizen.System; -using Xamarin.Forms; - -namespace Tizen.Network.Bluetooth.Tests -{ - [TestFixture] - [Description("VisibilityDurationChangedEventArgs Tests")] - public class VisibilityDurationChangedEventArgsTests - { - static bool isBluetoothSupported = false; - - [SetUp] - public static void Init() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported); - } - [TearDown] - public static void Destroy() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); - } - - public static void EventHandlerVisibilityDurationChanged(object sender, VisibilityDurationChangedEventArgs e) - { - Assert.IsTrue(e.Duration > 0, "Duration value is not proper"); - ManualTest.Confirm(); - } - - [Test] - [Category("P1")] - [Description("Test Duration. Check if Duration has proper value")] - [Property("SPEC", "Tizen.Network.Bluetooth.VisibilityDurationChangedEventArgs.Duration A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Sdb is connected as root with the target. \n>sdb root on")] - [Step(1, "Tap the Run button")] - [Step(2, "Run next command in the linux shell.\n>sdb shell dbus-send --system --type=signal /org/projectx/bt/adapter org.projectx.bt_event.DiscoverableTimeoutChanged int32:0 int16:0")] - [Step(3, "(Because there is no UX senario or entry point to set the visiable timeout, so we should generate the event using command line to pass this TCT")] - [Postcondition(1, "NA")] - public static async Task Duration_READ_ONLY() - { - try - { - EventHandler EventHandlerVisibilityDurationChanged = null; - - EventHandlerVisibilityDurationChanged = (sender, e) => { - Assert.IsInstanceOf(e.Duration, "duration parameter should be of type int"); - Log.Debug ("TCT", "[TestCase][VisibilityDurationChangedEventArgs][Duration_READ_ONLY] Pass"); - BluetoothHelper.DisplayPassLabel("VisibilityDurationChangedEventArgs.Duration_READ_ONLY"); - BluetoothAdapter.VisibilityDurationChanged -= EventHandlerVisibilityDurationChanged; - }; - - BluetoothAdapter.VisibilityDurationChanged += EventHandlerVisibilityDurationChanged; - - await ManualTest.WaitForConfirm(); - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("Duration_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Duration_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/TSVisibilityModeChangedEventArgs.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSVisibilityModeChangedEventArgs.cs deleted file mode 100755 index 6643816..0000000 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSVisibilityModeChangedEventArgs.cs +++ /dev/null @@ -1,136 +0,0 @@ -//The Below code shall be enabled when UI restriction for setting the visibility parameters is fixed -using System; -using System.Threading.Tasks; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Tizen.System; -using Xamarin.Forms; - -namespace Tizen.Network.Bluetooth.Tests -{ - [TestFixture] - [Description("VisibilityModeChangedEventArgs Tests")] - public class VisibilityModeChangedEventArgsTests - { - static VisibilityMode visibility; - static bool isBluetoothSupported = false; - - [SetUp] - public static void Init() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported); - } - [TearDown] - public static void Destroy() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Test Result. Check if Result has proper value")] - [Property("SPEC", "Tizen.Network.Bluetooth.VisibilityModeChangedEventArgs.Result A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Sdb is connected as root with the target. \n>sdb root on")] - [Step(1, "Tap the Run button")] - [Step(2, "Run next command in the linux shell.\n>sdb shell dbus-send --system --type=signal /org/projectx/bt/adapter org.projectx.bt_event.DiscoverableModeChanged int32:0 int16:1")] - [Step(3, "(Because there is no UX senario or entry point to set the visiable mode change, so we should generate the event using command line to pass this TCT")] - [Postcondition(1, "NA")] - public static async Task Result_READ_ONLY() - { - try - { - EventHandler EventHandlerVisibilityModeChanged = null; - - EventHandlerVisibilityModeChanged = (sender, e) => { - if (e.Result == BluetoothError.None) - { - Log.Debug ("TCT", "[TestCase][VisibilityModeChanged][Result_READ_ONLY] Pass"); - BluetoothHelper.DisplayPassLabel("VisibilityModeChangedEventArgs.Result_READ_ONLY"); - BluetoothAdapter.VisibilityModeChanged -= EventHandlerVisibilityModeChanged; - } - }; - - BluetoothAdapter.VisibilityModeChanged += EventHandlerVisibilityModeChanged; - - await ManualTest.WaitForConfirm(); - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("Result_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Result_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test Visibility. Check if the Visibility has correct value")] - [Property("SPEC", "Tizen.Network.Bluetooth.VisibilityModeChangedEventArgs.Visibility A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Sdb is connected as root with the target. \n>sdb root on")] - [Step(1, "Tap the Run button")] - [Step(2, "Run next command in the linux shell.\n>sdb shell dbus-send --system --type=signal /org/projectx/bt/adapter org.projectx.bt_event.DiscoverableModeChanged int32:0 int16:1")] - [Step(3, "(Because there is no UX senario or entry point to set the visiable mode change, so we should generate the event using command line to pass this TCT")] - [Postcondition(1, "NA")] - public static async Task Visibility_READ_ONLY() - { - try - { - EventHandler EventHandlerVisibilityModeChanged = null; - - EventHandlerVisibilityModeChanged = (sender, e) => { - Assert.IsInstanceOf(e.Visibility, "Visibility parameter should be of type VisibilityMode"); - Log.Debug ("TCT", "[TestCase][VisibilityModeChanged][Result_READ_ONLY] Pass"); - BluetoothHelper.DisplayPassLabel("VisibilityModeChangedEventArgs.Result_READ_ONLY"); - BluetoothAdapter.VisibilityModeChanged -= EventHandlerVisibilityModeChanged; - }; - - BluetoothAdapter.VisibilityModeChanged += EventHandlerVisibilityModeChanged; - - await ManualTest.WaitForConfirm(); - } - catch (NotSupportedException) - { - if (isBluetoothSupported == false) - { - BluetoothHelper.DisplayLabel("Visibility_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (TypeInitializationException e) - { - if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { - BluetoothHelper.DisplayLabel("Visibility_READ_ONLY"); - await ManualTest.WaitForConfirm(); - } - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - } -}