[Non-ACR][Bluetooth][Manual]Enable Bluetooth OPP Client TCs] 15/197015/6
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 9 Jan 2019 01:55:16 +0000 (10:55 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 11 Jan 2019 03:56:47 +0000 (12:56 +0900)
Change-Id: I1973f38b642c5d5f408161eee0ae1f2b6c47a3e0
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/shared/res/test1.jpg [new file with mode: 0755]
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/BluetoothSetup.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/PreconditionUtils.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothOppClient.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSPushFinishedEventArgs.cs [changed mode: 0755->0644]
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSPushProgressEventArgs.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSPushRespondedEventArgs.cs

diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/shared/res/test1.jpg b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/shared/res/test1.jpg
new file mode 100755 (executable)
index 0000000..c090428
Binary files /dev/null and b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/shared/res/test1.jpg differ
index 23617adb4c7445935d79bf03cb2c04b5ba56e939..2e6298b07f8254905ebab962de06ad70f2ed9eac 100644 (file)
@@ -20,6 +20,7 @@ namespace BluetoothNetworkUtils
         public static BluetoothAudio BtAudio = null;
         public static BluetoothAvrcp BtAvrcp = null;
         public static BluetoothHid BtHid = null;
+        public static BluetoothOppClient BtOppClient = null;
         public static BluetoothServerSocket Server = null;
         public static IBluetoothServerSocket Socket = null;
         public static IBluetoothClientSocket Client = null;
@@ -887,5 +888,29 @@ namespace BluetoothNetworkUtils
             StateChanged_flag = false;
             role = "";
         }
+
+        public static BluetoothOppClient GetBluetoothOppClientUtil()
+        {
+            if (BtOppClient != null)
+                return BtOppClient;
+
+            pairedDevice = BluetoothAdapter.GetBondedDevice(remote_addr);
+
+            if (pairedDevice != null)
+            {
+                BtOppClient = pairedDevice.GetProfile<BluetoothOppClient>();
+            }
+            else
+            {
+                LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "No matched paired device");
+            }
+
+            return BtOppClient;
+        }
+
+        public static BluetoothDevice GetPairedDevice()
+        {
+            return pairedDevice;
+        }
     }
 }
index 53f58b3daf7fbfba39ff9e52657a03917eb5818d..f4c3e2d923cc508836b45ea3538d1e63c3ea46e8 100755 (executable)
@@ -24,6 +24,7 @@ namespace BluetoothNetworkUtils
     {
         public static string BT_REMOTE_BLE_DEVICE_ADDRESS = null;
         public static string BT_REMOTE_HID_DEVICE_ADDRESS = null;
+        public static string BT_REMOTE_OPP_DEVICE_ADDRESS = null;
         public static string default_remote_addr = "AA:AA:AA:AA:AA:AA";
 
         public static string GetBleAddress ()
@@ -42,6 +43,14 @@ namespace BluetoothNetworkUtils
             return BT_REMOTE_HID_DEVICE_ADDRESS;
         }
 
+        public static string GetOppAddress ()
+        {
+            if (BT_REMOTE_OPP_DEVICE_ADDRESS == null)
+                SetPrecondition();
+
+            return BT_REMOTE_OPP_DEVICE_ADDRESS;
+        }
+
         public static string GetDefaultAddress ()
         {
             return default_remote_addr;
@@ -73,6 +82,11 @@ namespace BluetoothNetworkUtils
                         resultArray[index + 1] = resultArray[index + 1].Replace("\\", "");
                         BT_REMOTE_HID_DEVICE_ADDRESS = resultArray[index + 1];
                         break;
+                    case "BT_REMOTE_OPP_DEVICE_ADDRESS":
+                        // Remove backslash
+                        resultArray[index + 1] = resultArray[index + 1].Replace("\\", "");
+                        BT_REMOTE_OPP_DEVICE_ADDRESS = resultArray[index + 1];
+                        break;
                      default:
                         break;
                 }
index 9434d85440cedc9224d4eb4f60ee8f0e1d2abc14..5cc666b4b6c7f8729b0dfb126f6ebffbea862f2d 100755 (executable)
@@ -4,7 +4,8 @@ using NUnit.Framework;
 using NUnit.Framework.TUnit;
 using BluetoothNetworkUtils;
 using Tizen.System;
-using Xamarin.Forms;
+using System.IO;
+using Tizen.Applications;
 
 namespace Tizen.Network.Bluetooth.Tests
 {
@@ -12,16 +13,9 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("BluetoothOppClient Tests")]
     public class BluetoothOppClientTests
     {
-        static bool _flagDiscovery = false;
-        static bool _flagPushResponded = false;
-        static bool _flagPushProgress = false;
-        static bool _flagPushFinished = false;
-        static bool _flagCancelPush = false;
         static BluetoothDevice _device = null;
         static BluetoothOppClient _oppClient = null;
-        const string filePath = "/opt/usr/home/owner/share/image1.jpg";
-        const string invalidfilePath = "/opt/usr/home/owner/share/image2.jpg";
-        public static string _remoteAddress = PreconditionUtils.GetBleAddress();
+        private static string filePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "test1.jpg");
         static bool isBluetoothOppSupported = false;
 
         [SetUp]
@@ -37,87 +31,7 @@ namespace Tizen.Network.Bluetooth.Tests
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
         }
 
-        public static async Task DiscoverySetup()
-        {
-            LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Setup DiscoverySetup");
-            BluetoothAdapter.DiscoveryStateChanged += EventHandlerDiscoveryChanged;
-            BluetoothAdapter.StartDiscovery();
-            await WaitForDiscoveryflag();
-            BluetoothAdapter.StopDiscovery();
-            await Task.Delay(8000);
-            BluetoothAdapter.DiscoveryStateChanged -= EventHandlerDiscoveryChanged;
-        }
-
-        public static async Task WaitForDiscoveryflag()
-        {
-            int count = 0;
-            while (true)
-            {
-                await Task.Delay(1000);
-                count++;
-                if (_flagDiscovery)
-                    break;
-                if (count == 8)
-                    break;
-            }
-        }
-
-        public static void EventHandlerDiscoveryChanged(object sender, DiscoveryStateChangedEventArgs e)
-        {
-            LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Remote Address: " + _remoteAddress);
-
-            if (e.DiscoveryState == BluetoothDeviceDiscoveryState.Found && e.DeviceFound.Address.Equals(_remoteAddress))
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerDiscoveryChanged: " + e.DeviceFound.Address);
-                _device = e.DeviceFound;
-                _oppClient = _device.GetProfile<BluetoothOppClient>();
-                _flagDiscovery = true;
-            }
-        }
-
-        public static void EventHandlerPushProgress(object sender, PushProgressEventArgs e)
-        {
-            if (e.Size > 0)
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushProgress");
-                _flagPushProgress = true;
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "File : " + e.File + " Size : " + e.Size + " Percent : " + e.Percent + "%");
-                if (_flagCancelPush)
-                {
-                    try
-                    {
-                        _oppClient.CancelPush();
-                        ManualTest.Confirm();
-                    }
-                    catch (Exception ex)
-                    {
-                        Assert.Fail("[TestCase][BluetoothOppClient][EventHandlerPushProgress] FAIL " + ex.Message);
-                    }
-                }
-            }
-        }
-
-        public static void EventHandlerPushFinished(object sender, PushFinishedEventArgs e)
-        {
-            int _result = e.Result;
-            if (_result == 0)
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushFinished");
-                _flagPushFinished = true;
-                ManualTest.Confirm();
-            }
-        }
-
-        public static void EventHandlerPushResponded(object sender, PushRespondedEventArgs e)
-        {
-            if (e.Address != null)
-            {
-                _flagPushResponded = true;
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushResponded");
-            }
-        }
-
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test PushFile, check if PushFile method works properly")]
         [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushFile M")]
@@ -125,87 +39,53 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "MR")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
-                _oppClient.AddFile(filePath);
-                _oppClient.PushFile(_device.Address);
-                await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushResponded, "[TestCase][BluetoothOppClient][PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE] Failed");
-            }
-            catch (NotSupportedException)
-            {
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
                 if (isBluetoothOppSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
                     await ManualTest.WaitForConfirm();
+                    return;
                 }
-            }
-            catch (TypeInitializationException e)
-            {
-                if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
-                    BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
-                    await ManualTest.WaitForConfirm();
-                }
-            }
-            catch (Exception ex)
-            {
-                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
-            }
-        }
 
-        //[Test]
-        [Category("P1")]
-        [Description("Test PushFile, check if PushFile throws InvalidOperationException")]
-        [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushFile M")]
-        [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MEX")]
-        [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")]
-        [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
-        [Step(1, "Tap the Run button")]
-        [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
-        [Postcondition(1, "NA")]
-        public static async Task PushFile_CHECK_FOR_EXCEPTIONAsync()
-        {
-            //TEST CODE
-            try
-            {
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
+
+                EventHandlerPushFinished = (sender, e) => {
+                    if (e.Result == 0)
+                    {
+                        BluetoothHelper.DisplayPassLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
+                        _oppClient.PushFinished -= EventHandlerPushFinished;
+                    }
+                };
+
                 _oppClient.PushFinished += EventHandlerPushFinished;
-                Assert.Throws<InvalidOperationException>(() =>
-                {
-                    _oppClient.PushFile(_device.Address);
-                }, "PushFile should throw InvalidOperationException");
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
+
+                _oppClient.AddFile(filePath);
+
+                _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
+                await ManualTest.WaitForConfirm();
             }
             catch (NotSupportedException)
             {
                 if (isBluetoothOppSupported == false)
                 {
-                    BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_EXCEPTIONAsync");
+                    BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
                     await ManualTest.WaitForConfirm();
                 }
             }
@@ -213,7 +93,7 @@ namespace Tizen.Network.Bluetooth.Tests
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                                {
-                    BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_EXCEPTIONAsync");
+                    BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
                     await ManualTest.WaitForConfirm();
                 }
             }
@@ -223,7 +103,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test AddFile, check if AddFile method works properly")]
         [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.AddFile M")]
@@ -231,87 +111,53 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "MR")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
-                _oppClient.AddFile(filePath);
-                _oppClient.PushFile(_device.Address);
-                await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushResponded, "[TestCase][BluetoothOppClient][AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE] Failed");
-            }
-            catch (NotSupportedException)
-            {
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
                 if (isBluetoothOppSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
                     await ManualTest.WaitForConfirm();
+                    return;
                 }
-            }
-            catch (TypeInitializationException e)
-            {
-                if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
-                    BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
-                    await ManualTest.WaitForConfirm();
-                }
-            }
-            catch (Exception ex)
-            {
-                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
-            }
-        }
 
-        //[Test]
-        [Category("P1")]
-        [Description("Test AddFile, check if AddFile method throws InvalidOperationException")]
-        [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.AddFile M")]
-        [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MEX")]
-        [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")]
-        [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
-        [Step(1, "Tap the Run button")]
-        [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
-        [Postcondition(1, "NA")]
-        public static async Task AddFile_CHECK_FOR_EXECPTIONAsync()
-        {
-            try
-            {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
+
+                EventHandlerPushFinished = (sender, e) => {
+                    if (e.Result == 0)
+                    {
+                        BluetoothHelper.DisplayPassLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
+                        _oppClient.PushFinished -= EventHandlerPushFinished;
+                    }
+                };
+
                 _oppClient.PushFinished += EventHandlerPushFinished;
-                Assert.Throws<InvalidOperationException>(() =>
-                {
-                    _oppClient.AddFile(invalidfilePath);
-                }, "AddFile should throw InvalidOperationException");
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
+
+                _oppClient.AddFile(filePath);
+
+                _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
+                await ManualTest.WaitForConfirm();
             }
             catch (NotSupportedException)
             {
                 if (isBluetoothOppSupported == false)
                 {
-                    BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_EXECPTIONAsync");
+                    BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
                     await ManualTest.WaitForConfirm();
                 }
             }
@@ -319,7 +165,7 @@ namespace Tizen.Network.Bluetooth.Tests
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                                {
-                    BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_EXECPTIONAsync");
+                    BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
                     await ManualTest.WaitForConfirm();
                 }
             }
@@ -329,7 +175,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test ClearFiles, check if ClearFiles method works properly")]
         [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.ClearFiles M")]
@@ -337,26 +183,47 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "MR")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
-        public static async Task ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILESAsync()
+        public static async Task ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILESAsync");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
+
+                EventHandlerPushFinished = (sender, e) => {
+                    if (e.Result == 0)
+                    {
+                        BluetoothHelper.DisplayPassLabel("ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILESAsync");
+                        _oppClient.PushFinished -= EventHandlerPushFinished;
+                    }
+                };
+
                 _oppClient.PushFinished += EventHandlerPushFinished;
+
                 _oppClient.AddFile(filePath);
+
+                _oppClient.PushFile(_device.Address);
+
                 _oppClient.ClearFiles();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
+
+                await ManualTest.WaitForConfirm();
             }
             catch (NotSupportedException)
             {
@@ -380,7 +247,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test CancelPush, check if CancelPush method works properly")]
         [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.CancelPush M")]
@@ -388,88 +255,58 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "MR")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
-                _oppClient.AddFile(filePath);
-                _flagCancelPush = true;
-                _oppClient.PushFile(_device.Address);
-                await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushResponded, "[TestCase][BluetoothOppClient][CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH] Failed");
-            }
-            catch (NotSupportedException)
-            {
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
                 if (isBluetoothOppSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
                     await ManualTest.WaitForConfirm();
+                    return;
                 }
-            }
-            catch (TypeInitializationException e)
-            {
-                if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
-                    BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
-                    await ManualTest.WaitForConfirm();
-                }
-            }
-            catch (Exception ex)
-            {
-                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
-            }
-        }
 
-        //[Test]
-        [Category("P1")]
-        [Description("Test CancelPush, check if CancelPush method throws InvalidOperationException")]
-        [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.CancelPush M")]
-        [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MEX")]
-        [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")]
-        [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
-        [Step(1, "Tap the Run button")]
-        [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
-        [Postcondition(1, "NA")]
-        public static async Task CancelPush_CHECK_FOR_EXCEPTIONAsync()
-        {
-            try
-            {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
+
+                EventHandlerPushProgress = (sender, e) => {
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "File : " + e.File + " Size : " + e.Size + " Percent : " + e.Percent + "%");
+                    try
+                    {
+                        _oppClient.CancelPush();
+                        BluetoothHelper.DisplayPassLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
+                    }
+                    catch (Exception ex)
+                    {
+                        Assert.Fail("[TestCase][BluetoothOppClient][CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH] FAIL " + ex.Message);
+                    }
+                };
+
                 _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
-                Assert.Throws<InvalidOperationException>(() =>
-                {
-                    _oppClient.CancelPush();
-                }, "CancelPush should throw InvalidOperationException");
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
+
+                _oppClient.AddFile(filePath);
+
+                _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
+                await ManualTest.WaitForConfirm();
             }
             catch (NotSupportedException)
             {
                 if (isBluetoothOppSupported == false)
                 {
-                    BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_EXCEPTIONAsync");
+                    BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
                     await ManualTest.WaitForConfirm();
                 }
             }
@@ -477,7 +314,7 @@ namespace Tizen.Network.Bluetooth.Tests
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                                {
-                    BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_EXCEPTIONAsync");
+                    BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
                     await ManualTest.WaitForConfirm();
                 }
             }
@@ -487,7 +324,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-               // [Test]
+        [Test]
         [Category("P1")]
         [Description("Test PushResponded, check if PushResponded event is proper")]
         [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushResponded E")]
@@ -495,28 +332,47 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "EVL")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task PushResponded_CHECK_EVENT()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("PushResponded_CHECK_EVENT");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushRespondedEventArgs> EventHandlerPushResponsed = null;
+
+                EventHandlerPushResponsed = (sender, e) => {
+                    if (e.Result == 0)
+                    {
+                        BluetoothHelper.DisplayPassLabel("PushResponded_CHECK_EVENT");
+                        _oppClient.PushResponded -= EventHandlerPushResponsed;
+                    }
+                };
+
+                _oppClient.PushResponded += EventHandlerPushResponsed;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushResponded, "[TestCase][BluetoothOppClient][PushResponded_CHECK_EVENT] Failed");
             }
             catch (NotSupportedException)
             {
@@ -540,7 +396,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test PushProgress, check if PushProgress event is proper")]
         [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushProgress E")]
@@ -548,28 +404,47 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "EVL")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task PushProgress_CHECK_EVENT()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("PushProgress_CHECK_EVENT");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
+
+                EventHandlerPushProgress = (sender, e) => {
+                    if (e.Percent >= 0)
+                    {
+                        BluetoothHelper.DisplayPassLabel("PushProgress_CHECK_EVENT");
+                        _oppClient.PushProgress -= EventHandlerPushProgress;
+                    }
+                };
+
                 _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushProgress, "[TestCase][BluetoothOppClient][PushProgress_CHECK_EVENT] Failed");
             }
             catch (NotSupportedException)
             {
@@ -593,7 +468,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test PushFinished, check if PushFinished event is proper")]
         [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushFinished E")]
@@ -601,28 +476,47 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "EVL")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task PushFinished_CHECK_EVENT()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("PushProgress_CHECK_EVENT");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
+
+                EventHandlerPushFinished = (sender, e) => {
+                    if (e.Result == 0)
+                    {
+                        BluetoothHelper.DisplayPassLabel("PushProgress_CHECK_EVENT");
+                        _oppClient.PushFinished -= EventHandlerPushFinished;
+                    }
+                };
+
                 _oppClient.PushFinished += EventHandlerPushFinished;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushFinished, "[TestCase][BluetoothOppClient][PushFinished_CHECK_EVENT] Failed");
             }
             catch (NotSupportedException)
             {
@@ -635,7 +529,7 @@ namespace Tizen.Network.Bluetooth.Tests
             catch (TypeInitializationException e)
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                {
                     BluetoothHelper.DisplayLabel("PushFinished_CHECK_EVENT");
                     await ManualTest.WaitForConfirm();
                 }
old mode 100755 (executable)
new mode 100644 (file)
index 7f75bc3..b2bc89a
@@ -4,7 +4,8 @@ using NUnit.Framework;
 using NUnit.Framework.TUnit;
 using BluetoothNetworkUtils;
 using Tizen.System;
-using Xamarin.Forms;
+using System.IO;
+using Tizen.Applications;
 
 namespace Tizen.Network.Bluetooth.Tests
 {
@@ -12,15 +13,9 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("PushFinishedEventArgs Tests")]
     public class PushFinishedEventArgsTests
     {
-        static bool _flagDiscovery = false;
-        static bool _flagPushResponded = false;
-        static bool _flagPushProgress = false;
-        static bool _flagPushFinished = false;
-        static bool _flagCancelPush = false;
         static BluetoothDevice _device = null;
         static BluetoothOppClient _oppClient = null;
-        const string filePath = "/opt/usr/home/owner/share/image1.jpg";
-        public static string _remoteAddress = PreconditionUtils.GetBleAddress();
+        private static string filePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "test1.jpg");
         static bool isBluetoothOppSupported = false;
 
         [SetUp]
@@ -36,85 +31,7 @@ namespace Tizen.Network.Bluetooth.Tests
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
         }
 
-        public static async Task DiscoverySetup()
-        {
-            LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Setup DiscoverySetup");
-            BluetoothAdapter.DiscoveryStateChanged += EventHandlerDiscoveryChanged;
-            BluetoothAdapter.StartDiscovery();
-            await WaitForDiscoveryflag();
-            BluetoothAdapter.StopDiscovery();
-            await Task.Delay(8000);
-            BluetoothAdapter.DiscoveryStateChanged -= EventHandlerDiscoveryChanged;
-        }
-
-        public static async Task WaitForDiscoveryflag()
-        {
-            int count = 0;
-            while (true)
-            {
-                await Task.Delay(1000);
-                count++;
-                if (_flagDiscovery)
-                    break;
-                if (count == 8)
-                    break;
-            }
-        }
-
-        public static void EventHandlerDiscoveryChanged(object sender, DiscoveryStateChangedEventArgs e)
-        {
-            if (e.DiscoveryState == BluetoothDeviceDiscoveryState.Found && e.DeviceFound.Address.Equals(_remoteAddress))
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerDiscoveryChanged");
-                _device = e.DeviceFound;
-                _oppClient = _device.GetProfile<BluetoothOppClient>();
-                _flagDiscovery = true;
-            }
-        }
-
-        public static void EventHandlerPushProgress(object sender, PushProgressEventArgs e)
-        {
-            if (e.Size > 0)
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushProgress");
-                _flagPushProgress = true;
-                if (_flagCancelPush)
-                {
-                    try
-                    {
-                        _oppClient.CancelPush();
-                        ManualTest.Confirm();
-                    }
-                    catch (Exception ex)
-                    {
-                        Assert.Fail("[TestCase][PushFinishedEventArgs][EventHandlerPushProgress] FAIL " + ex.Message);
-                    }
-                }
-            }
-        }
-
-        public static void EventHandlerPushFinished(object sender, PushFinishedEventArgs e)
-        {
-            int _result = e.Result;
-            if (_result == 0)
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushFinished");
-                _flagPushFinished = true;
-                ManualTest.Confirm();
-            }
-        }
-
-        public static void EventHandlerPushResponded(object sender, PushRespondedEventArgs e)
-        {
-            if (e.Address != null && e.Result == 0)
-            {
-                _flagPushResponded = true;
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushResponded");
-                //ManualTest.Confirm();
-            }
-        }
-
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test Address, check if Address has proper value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.PushFinishedEventArgs.Address A")]
@@ -122,28 +39,47 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task Address_PROPERTY_READ_ONLY()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
+
+                EventHandlerPushFinished = (sender, e) => {
+                    _oppClient.PushFinished -= EventHandlerPushFinished;
+                    Assert.IsNotNull(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
+                    Assert.IsInstanceOf<string>(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
+                    Assert.True(String.Equals(e.Address, _device.Address), "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
+                    BluetoothHelper.DisplayPassLabel("Address_PROPERTY_READ_ONLY");
+                };
+
                 _oppClient.PushFinished += EventHandlerPushFinished;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushFinished, "[TestCase][PushFinishedEventArgs][Address_PROPERTY_READ_ONLY] Failed");
             }
             catch (NotSupportedException)
             {
@@ -156,7 +92,7 @@ namespace Tizen.Network.Bluetooth.Tests
             catch (TypeInitializationException e)
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                {
                     BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -167,36 +103,53 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
-        [Description("Test Address, check if Address has proper value")]
+        [Description("Test Result, check if Result has proper value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.PushFinishedEventArgs.Result A")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task Result_PROPERTY_READ_ONLY()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
+
+                EventHandlerPushFinished = (sender, e) => {
+                    _oppClient.PushFinished -= EventHandlerPushFinished;
+                    Assert.IsTrue((int)e.Result == 0, "[TestCase][Result_PROPERTY_READ_ONLY] Failed");
+                    BluetoothHelper.DisplayPassLabel("Result_PROPERTY_READ_ONLY");
+                };
+
                 _oppClient.PushFinished += EventHandlerPushFinished;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushFinished, "[TestCase][PushFinishedEventArgs][Result_PROPERTY_READ_ONLY] Failed");
             }
             catch (NotSupportedException)
             {
@@ -209,7 +162,7 @@ namespace Tizen.Network.Bluetooth.Tests
             catch (TypeInitializationException e)
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                {
                     BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
index 2abf6d4ba368c35916f59993269ba6e4336a3abb..fd4c6ff535ed20fd1b54acc8d7dfd805e48a4627 100755 (executable)
@@ -4,7 +4,8 @@ using NUnit.Framework;
 using NUnit.Framework.TUnit;
 using BluetoothNetworkUtils;
 using Tizen.System;
-using Xamarin.Forms;
+using System.IO;
+using Tizen.Applications;
 
 namespace Tizen.Network.Bluetooth.Tests
 {
@@ -12,14 +13,9 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("PushProgressEventArgs Tests")]
     public class PushProgressEventArgsTests
     {
-        static bool _flagDiscovery = false;
-        static bool _flagPushResponded = false;
-        static bool _flagPushProgress = false;
-        static bool _flagPushFinished = false;
-        static bool _flagCancelPush = false;
         static BluetoothDevice _device = null;
         static BluetoothOppClient _oppClient = null;
-        const string filePath = "/opt/usr/home/owner/share/image1.jpg";
+        private static string filePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "test1.jpg");
         public static string _remoteAddress = PreconditionUtils.GetBleAddress();
         static bool isBluetoothOppSupported = false;
 
@@ -36,71 +32,7 @@ namespace Tizen.Network.Bluetooth.Tests
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
         }
 
-        public static async Task DiscoverySetup()
-        {
-            LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Setup DiscoverySetup");
-            BluetoothAdapter.DiscoveryStateChanged += EventHandlerDiscoveryChanged;
-            BluetoothAdapter.StartDiscovery();
-            await WaitForDiscoveryflag();
-            BluetoothAdapter.StopDiscovery();
-            await Task.Delay(8000);
-            BluetoothAdapter.DiscoveryStateChanged -= EventHandlerDiscoveryChanged;
-        }
-
-        public static async Task WaitForDiscoveryflag()
-        {
-            int count = 0;
-            while (true)
-            {
-                await Task.Delay(1000);
-                count++;
-                if (_flagDiscovery)
-                    break;
-                if (count == 8)
-                    break;
-            }
-        }
-
-        public static void EventHandlerDiscoveryChanged(object sender, DiscoveryStateChangedEventArgs e)
-        {
-            if (e.DiscoveryState == BluetoothDeviceDiscoveryState.Found && e.DeviceFound.Address.Equals(_remoteAddress))
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerDiscoveryChanged");
-                _device = e.DeviceFound;
-                _oppClient = _device.GetProfile<BluetoothOppClient>();
-                _flagDiscovery = true;
-            }
-        }
-
-        public static void EventHandlerPushProgress(object sender, PushProgressEventArgs e)
-        {
-            if (e.Size > 0 && e.File != null && e.Percent > 0)
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushProgress");
-                _flagPushProgress = true;
-            }
-        }
-
-        public static void EventHandlerPushFinished(object sender, PushFinishedEventArgs e)
-        {
-            int _result = e.Result;
-            if (_result == 0)
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushFinished");
-                ManualTest.Confirm();
-            }
-        }
-
-        public static void EventHandlerPushResponded(object sender, PushRespondedEventArgs e)
-        {
-            if (e.Address != null && e.Result == 0)
-            {
-                _flagPushResponded = true;
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushResponded");
-            }
-        }
-
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test File, check if File has proper value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.PushProgressEventArgs.File A")]
@@ -108,28 +40,47 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task File_PROPERTY_READ_ONLY()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
+
+                EventHandlerPushProgress = (sender, e) => {
+                    Assert.IsNotNull(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
+                    Assert.IsInstanceOf<string>(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
+                    Assert.True(String.Equals(e.File, filePath), "[TestCase][File_PROPERTY_READ_ONLY] Failed");
+                    BluetoothHelper.DisplayPassLabel("File_PROPERTY_READ_ONLY");
+                    _oppClient.PushProgress -= EventHandlerPushProgress;
+                };
+
                 _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushProgress, "[TestCase][PushProgressEventArgs][File_PROPERTY_READ_ONLY] Failed");
             }
             catch (NotSupportedException)
             {
@@ -142,7 +93,7 @@ namespace Tizen.Network.Bluetooth.Tests
             catch (TypeInitializationException e)
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                {
                     BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -153,7 +104,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test Size, check if Size has proper value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.PushProgressEventArgs.Size A")]
@@ -161,28 +112,46 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task Size_PROPERTY_READ_ONLY()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
+
+                EventHandlerPushProgress = (sender, e) => {
+                    _oppClient.PushProgress -= EventHandlerPushProgress;
+                    Assert.IsInstanceOf<long>(e.Size, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
+                    Assert.IsTrue(e.Size >= 0, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
+                    BluetoothHelper.DisplayPassLabel("Size_PROPERTY_READ_ONLY");
+                };
+
                 _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushProgress, "[TestCase][PushProgressEventArgs][Size_PROPERTY_READ_ONLY] Failed");
             }
             catch (NotSupportedException)
             {
@@ -195,7 +164,7 @@ namespace Tizen.Network.Bluetooth.Tests
             catch (TypeInitializationException e)
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                {
                     BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -206,7 +175,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test Percent, check if Percent has proper value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.PushProgressEventArgs.Percent A")]
@@ -214,28 +183,46 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task Percent_PROPERTY_READ_ONLY()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("Percent_PushProgressEventArgs_READ_ONLY");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
+
+                EventHandlerPushProgress = (sender, e) => {
+                    _oppClient.PushProgress -= EventHandlerPushProgress;
+                    Assert.IsInstanceOf<int>(e.Percent, "[TestCase][Percent_PROPERTY_READ_ONLY] Failed");
+                    Assert.IsTrue(e.Percent >= 0, "[TestCase][Percent_PROPERTY_READ_ONLY] Failed");
+                    BluetoothHelper.DisplayPassLabel("Percent_PROPERTY_READ_ONLY");
+                };
+
                 _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushProgress, "[TestCase][PushProgressEventArgs][Percent_PROPERTY_READ_ONLY] Failed");
             }
             catch (NotSupportedException)
             {
@@ -248,7 +235,7 @@ namespace Tizen.Network.Bluetooth.Tests
             catch (TypeInitializationException e)
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                {
                     BluetoothHelper.DisplayLabel("Percent_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
index eb9b934bd7f029c989f5f57102cda9178feaae1e..41acf0860de62687f58b3c6511c17bafe415d295 100755 (executable)
@@ -4,7 +4,8 @@ using NUnit.Framework;
 using NUnit.Framework.TUnit;
 using BluetoothNetworkUtils;
 using Tizen.System;
-using Xamarin.Forms;
+using System.IO;
+using Tizen.Applications;
 
 namespace Tizen.Network.Bluetooth.Tests
 {
@@ -12,12 +13,9 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("PushRespondedEventArgs Tests")]
     public class PushRespondedEventArgsTests
     {
-        static bool _flagDiscovery = false;
-        static bool _flagPushResponded = false;
-        static bool _flagCancelPush = false;
         static BluetoothDevice _device = null;
         static BluetoothOppClient _oppClient = null;
-        const string filePath = "/opt/usr/home/owner/share/image1.jpg";
+        private static string filePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "test1.jpg");
         public static string _remoteAddress = PreconditionUtils.GetBleAddress();
         static bool isBluetoothOppSupported = false;
 
@@ -34,82 +32,7 @@ namespace Tizen.Network.Bluetooth.Tests
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
         }
 
-        public static async Task DiscoverySetup()
-        {
-            LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Setup DiscoverySetup");
-            BluetoothAdapter.DiscoveryStateChanged += EventHandlerDiscoveryChanged;
-            BluetoothAdapter.StartDiscovery();
-            await WaitForDiscoveryflag();
-            BluetoothAdapter.StopDiscovery();
-            await Task.Delay(8000);
-            BluetoothAdapter.DiscoveryStateChanged -= EventHandlerDiscoveryChanged;
-        }
-
-        public static async Task WaitForDiscoveryflag()
-        {
-            int count = 0;
-            while (true)
-            {
-                await Task.Delay(1000);
-                count++;
-                if (_flagDiscovery)
-                    break;
-                if (count == 8)
-                    break;
-            }
-        }
-
-        public static void EventHandlerDiscoveryChanged(object sender, DiscoveryStateChangedEventArgs e)
-        {
-            if (e.DiscoveryState == BluetoothDeviceDiscoveryState.Found && e.DeviceFound.Address.Equals(_remoteAddress))
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerDiscoveryChanged");
-                _device = e.DeviceFound;
-                _oppClient = _device.GetProfile<BluetoothOppClient>();
-                _flagDiscovery = true;
-            }
-        }
-
-        public static void EventHandlerPushProgress(object sender, PushProgressEventArgs e)
-        {
-            if (e.Size > 0)
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushProgress");
-                if (_flagCancelPush)
-                {
-                    try
-                    {
-                        _oppClient.CancelPush();
-                        ManualTest.Confirm();
-                    }
-                    catch (Exception ex)
-                    {
-                        Assert.Fail("[TestCase][PushRespondedEventArgs][EventHandlerPushProgress] FAIL " + ex.Message);
-                    }
-                }
-            }
-        }
-
-        public static void EventHandlerPushFinished(object sender, PushFinishedEventArgs e)
-        {
-            int _result = e.Result;
-            if (_result == 0)
-            {
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushFinished");
-                ManualTest.Confirm();
-            }
-        }
-
-        public static void EventHandlerPushResponded(object sender, PushRespondedEventArgs e)
-        {
-            if (e.Address != null && e.Result == 0)
-            {
-                _flagPushResponded = true;
-                LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "EventHandlerPushResponded");
-            }
-        }
-
-        //[Test]
+        [Test]
         [Category("P1")]
         [Description("Test Address, check if Address has proper value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.PushRespondedEventArgs.Address A")]
@@ -117,28 +40,47 @@ namespace Tizen.Network.Bluetooth.Tests
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task Address_PROPERTY_READ_ONLY()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushRespondedEventArgs> EventHandlerPushResponsed = null;
+
+                EventHandlerPushResponsed = (sender, e) => {
+                    _oppClient.PushResponded -= EventHandlerPushResponsed;
+                    Assert.IsNotNull(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
+                    Assert.IsInstanceOf<string>(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
+                    Assert.True(String.Equals(e.Address, _device.Address), "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
+                    BluetoothHelper.DisplayPassLabel("Address_PROPERTY_READ_ONLY");
+                };
+
+                _oppClient.PushResponded += EventHandlerPushResponsed;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushResponded, "[TestCase][PushRespondedEventArgs][Address_PROPERTY_READ_ONLY] Failed");
             }
             catch (NotSupportedException)
             {
@@ -151,7 +93,7 @@ namespace Tizen.Network.Bluetooth.Tests
             catch (TypeInitializationException e)
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                {
                     BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -162,36 +104,53 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        //[Test]
+        [Test]
         [Category("P1")]
-        [Description("Test Address, check if Address has proper value")]
+        [Description("Test Result, check if Result has proper value")]
         [Property("SPEC", "Tizen.Network.Bluetooth.PushRespondedEventArgs.Result A")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "PRO")]
         [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
-        [Precondition(2, "Create, copy and put an image file (image1.jpg) in location /opt/usr/home/owner/share/")]
-        [Precondition(3, "Keep Bluetooth settings open on Server device, which makes it visible")]
+        [Precondition(2, "Paired with the remote OPP server device")]
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
-        [Step(3, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
         [Postcondition(1, "NA")]
         public static async Task Result_PROPERTY_READ_ONLY()
         {
             try
             {
-                //TEST CODE
-                await DiscoverySetup();
-                _oppClient.PushResponded += EventHandlerPushResponded;
-                _oppClient.PushProgress += EventHandlerPushProgress;
-                _oppClient.PushFinished += EventHandlerPushFinished;
+                /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+                if (isBluetoothOppSupported == false)
+                {
+                    BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
+                _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
+
+                Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
+
+                _device = BluetoothSetup.GetPairedDevice();
+
+                EventHandler<PushRespondedEventArgs> EventHandlerPushResponsed = null;
+
+                EventHandlerPushResponsed = (sender, e) => {
+                    _oppClient.PushResponded -= EventHandlerPushResponsed;
+                    Assert.IsTrue((int)e.Result == 0, "[TestCase][Result_PROPERTY_READ_ONLY] Failed");
+                    BluetoothHelper.DisplayPassLabel("Result_PROPERTY_READ_ONLY");
+                };
+
+                _oppClient.PushResponded += EventHandlerPushResponsed;
+
                 _oppClient.AddFile(filePath);
+
                 _oppClient.PushFile(_device.Address);
+
+                _oppClient.ClearFiles();
+
                 await ManualTest.WaitForConfirm();
-                _oppClient.PushResponded -= EventHandlerPushResponded;
-                _oppClient.PushProgress -= EventHandlerPushProgress;
-                _oppClient.PushFinished -= EventHandlerPushFinished;
-                Assert.IsTrue(_flagPushResponded, "[TestCase][PushRespondedEventArgs][Result_PROPERTY_READ_ONLY] Failed");
             }
             catch (NotSupportedException)
             {
@@ -204,7 +163,7 @@ namespace Tizen.Network.Bluetooth.Tests
             catch (TypeInitializationException e)
             {
                 if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                {
                     BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }