[Network][TCSACR-149] Add TC for new APIs such as BssidScan, RawSsid, etc. 33/182933/7
authorchleun.moon <chleun.moon@samsung.com>
Fri, 29 Jun 2018 01:11:05 +0000 (10:11 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Wed, 4 Jul 2018 05:05:55 +0000 (14:05 +0900)
Change-Id: Ibafeb8855719e139689b42c2f8e65443058f6293
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiAP.cs
tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiManager.cs [changed mode: 0755->0644]
tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiNetwork.cs [changed mode: 0755->0644]

index 23568e1..e6141e3 100644 (file)
@@ -181,7 +181,7 @@ namespace Tizen.Network.WiFi.Tests
             WiFiAP _wifiAP = null;
             try
             {
-                /*Precondition
+                /* Precondition
                  * Setup WiFi type public
                  * */
                 await SetUp();
@@ -528,6 +528,79 @@ namespace Tizen.Network.WiFi.Tests
             }
         }
 
+        [Test]
+        [Category("P1")]
+        [Description("Cancel the request to connect by WPS")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.CancelWps M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")]
+        public static async Task CancelWps_CANCELWPS()
+        {
+            Log.Info(Globals.LogTag, "CancelWps_CANCELWPS");
+
+            try
+            {
+                WpsInfo info = new WpsPbcInfo();
+                var task = WiFiAP.ConnectWpsWithoutSsidAsync(info);
+                await Task.Delay(2000);
+                WiFiAP.CancelWps();
+
+                Assert.IsTrue(task.IsCanceled, "ConnectWpsWithoutSsidAsync() isn't cancelled");
+
+                // Postcondition
+                await SetUp();
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Cancel WPS without the request to connect by WPS")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.CancelWps M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")]
+        public static async Task CancelWps_INVALID_OPERATION_EXCEPTION()
+        {
+            Log.Info(Globals.LogTag, "CancelWps_CANCELWPS");
+
+            try
+            {
+                WiFiAP.CancelWps();
+                Assert.IsTrue(false, "InvalidOperationException must be thrown");
+
+                // Postcondition
+                await SetUp();
+            }
+            catch (InvalidOperationException ex)
+            {
+                Assert.IsTrue(true, "Exception occurs. Msg: " + ex.ToString());
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+        }
 
    }
 }
old mode 100755 (executable)
new mode 100644 (file)
index 0856c9f..ca493a1
@@ -908,5 +908,76 @@ namespace Tizen.Network.WiFi.Tests
             _flag = true;
         }
 
+        [Test]
+        [Category("P1")]
+        [Description("starts BSSID scan asynchronously")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.BssidScanAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")]
+        public static async Task BssidScanAsync_BSSIDSCAN()
+        {
+            try
+            {
+                await setUp();
+
+                var count = 0;
+                await WiFiManager.BssidScanAsync();
+                var listAp = WiFiManager.GetFoundBssids();
+                foreach (var item in listAp)
+                    count++;
+                Assert.Greater(count, 0, "BssidScanAsync can't scan any WiFiAp");
+
+                Log.Info(Globals.LogTag, "Successfully done");
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test: Gets the result of the BssidScanAsync asynchronously")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetFoundBssids M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")]
+        public static async Task GetFoundBssids_BSSIDSCAN_AND_GET_ALL_AP()
+        {
+            try
+            {
+                await setUp();
+
+                var count = 0;
+                await WiFiManager.BssidScanAsync();
+                var listAp = WiFiManager.GetFoundBssids();
+                foreach (var item in listAp)
+                    count++;
+                Assert.Greater(count, 0, "GetFoundBssids fail");
+
+                Log.Info(Globals.LogTag, "Successfully done");
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+        }
     }
 }
old mode 100755 (executable)
new mode 100644 (file)
index c74e7f0..0d7ff40
@@ -1,4 +1,5 @@
 using System;
+using System.Text;
 using Tizen.Network.Connection;
 using System.Threading.Tasks;
 using networkUtils;
@@ -93,6 +94,60 @@ namespace Tizen.Network.WiFi.Tests
 
         [Test]
         [Category("P1")]
+        [Description("Test RawSsid property of WiFiNetwork")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.RawSsid A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Cheoleun, chleun.moon@samsung.com")]
+        public static async Task RawSsid_PROPERTY()
+        {
+            WiFiAP _wifiAP = null;
+            WiFiNetwork _wiFiNetwork = null;
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * Activate WiFi then get WiFi connected
+                 * Create a WiFiNetwork object
+                 */
+                await SetUp();
+
+                /*
+                 * TEST CODE
+                 */
+                _wifiAP = WiFiManager.GetConnectedAP();
+                Assert.IsNotNull(_wifiAP, "No WiFi connection");
+                _wiFiNetwork = _wifiAP.NetworkInformation;
+                var rawSsid = _wiFiNetwork.RawSsid;
+                string ssid = Encoding.UTF8.GetString(rawSsid);
+                Log.Info(Globals.LogTag, "Converted SSID: " + ssid);
+                Assert.AreEqual(networkParameter.wnPRIVATE, ssid, "Invalid RawSsid");
+
+                Log.Info(Globals.LogTag, "Successfully done");
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+            finally
+            {
+                if (_wifiAP != null)
+                {
+                    _wifiAP.Dispose();
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("Test Bssid property of WiFiNetwork")]
         [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.Bssid A")]
         [Property("SPEC_URL", "-")]
@@ -145,6 +200,109 @@ namespace Tizen.Network.WiFi.Tests
 
         [Test]
         [Category("P1")]
+        [Description("Get all BSSIDs of a WiFiAp")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.GetBssids M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")]
+        public static async Task GetBssids_GET()
+        {
+            WiFiAP _wifiAP = null;
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * 1. Activate WiFi then connect to a AP.
+                 * 2. Get connect AP
+                 */
+                Log.Info(Globals.LogTag, "GetBssids_GET start");
+                await SetUp();
+                _wifiAP = WiFiManager.GetConnectedAP();
+                Assert.IsNotNull(_wifiAP, "No WiFi connection");
+
+                /* TEST CODE */
+                var list = _wifiAP.NetworkInformation.GetBssids();
+                Assert.IsNotNull(list, "GetBssids fails");
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+            finally
+            {
+                if (_wifiAP != null)
+                {
+                    _wifiAP.Dispose();
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test CountryCode property of WiFiNetwork")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.CountryCode A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")]
+        public static async Task CountryCode_PROPERTY()
+        {
+            WiFiAP _wifiAP = null;
+            WiFiNetwork _wiFiNetwork = null;
+            try
+            {
+                /*
+                 * PRECONDITION
+                 * Activate WiFi then get WiFi connected
+                 * Create a WiFiNetwork object
+                 */
+                await SetUp();
+
+                /*
+                 * TEST CODE
+                 */
+                _wifiAP = WiFiManager.GetConnectedAP();
+                Assert.IsNotNull(_wifiAP, "No WiFi connection");
+                _wiFiNetwork = _wifiAP.NetworkInformation;
+                var code = _wiFiNetwork.CountryCode;
+
+                /*
+                 * The country code can be NULL if AP or M/W do not have the country code.
+                 * Therefore, we check only if there is no exception when CountryCode is accessed.
+                 */
+
+                Log.Info(Globals.LogTag, "Successfully done");
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+            finally
+            {
+                if (_wifiAP != null)
+                {
+                    _wifiAP.Dispose();
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("Test ConnectionState property of WiFiNetwork")]
         [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.ConnectionState A")]
         [Property("SPEC_URL", "-")]