[NFC][Non-ACR][Change TC for change NFC Csharp implementation] 61/196361/13
authorJihoon Jung <jh8801.jung@samsung.com>
Thu, 27 Dec 2018 22:56:03 +0000 (07:56 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Fri, 4 Jan 2019 07:17:54 +0000 (07:17 +0000)
- For NFC csharp change (https://github.com/Samsung/TizenFX/pull/578),
This is a TC correction related to NFC card emulation that has not been properly verified.

Change-Id: Ibb022cd7256ca4d9a2f468641dc554458ec78b14
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
tct-suite-vs/Tizen.Nfc.Manual.Tests/testcase/TSNfcCardEmulationAdapter.cs
tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcCardEmulationAdapter.cs
tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcRegisteredAidInformation.cs

index 16cbdd6f6142840d153b6b6cff646a8cc6e57a5e..741ac1591338ce3b44930a7fce24e552f6bdb449 100755 (executable)
@@ -449,5 +449,52 @@ namespace Tizen.Network.Nfc.Tests
                     "Method throw the NotSupportedException, but Tizen support the Nfc host card emulation opearation");
             }
         }
+
+        [Test]
+        [Category("P1")]
+        [Description("Give the priority to the foreground application when dispatching transaction event.")]
+        [Property("SPEC", "Tizen.Network.Nfc.NfcCardEmulationAdapter.EnableTransactionForegroundDispatch M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jihoon Jung, jh8801.jung@samsung.com")]
+        [Precondition(1, "Turn on NFC on testing device")]
+        [Precondition(2, "Make this TC application ready for HCE through NFC setting")]
+        [Step(1, "Tap the Run button")]
+        [Step(2, "If after tap the Run button, error is None, test case will pass automatically else it will fail")]
+        public void EnableTransactionForegroundDispatch_METHOD_RETURN()
+        {
+            try
+            {
+                /* POSTCONDITION
+                * 1. Gets the card emulation adapter
+                */
+                _cardEmulationAdapter = NfcManager.GetCardEmulationAdapter();
+                Assert.IsNotNull(_cardEmulationAdapter, "_cardEmulationAdapter should not be null");\r
+\r
+                /* TEST CODE */\r
+                _cardEmulationAdapter.EnableTransactionForegroundDispatch();
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(_nfcFeature == false || _ceFeature == false,
+                    "Method throw the NotSupportedException, but Tizen support the Nfc host card emulation opearation");
+            }
+            catch (Exception ex)
+            {\r
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());\r
+            }
+
+            finally\r
+            {\r
+                /* POSTCONDITION\r
+                * 1. Reset variables\r
+                */\r
+\r
+                if (_cardEmulationAdapter != null)\r
+                {\r
+                    _cardEmulationAdapter = null;\r
+                }\r
+            }
+        }
     }
 }
index 22d8d19fb6edeae61aa7f6c2d7842f3559b3ae1b..ddfbf8ff7da88ef54c8a4df27f9c4c2c557af877 100755 (executable)
@@ -129,28 +129,47 @@ namespace Tizen.Network.Nfc.Tests
             {
                 Assert.IsTrue(isNfcSupported == false || isCeSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation");
             }
-        }
-
-        [Test]
-        [Category("P1")]
-        [Description("Give the priority to the foreground application when dispatching transaction event.")]
-        [Property("SPEC", "Tizen.Network.Nfc.NfcCardEmulationAdapter.EnableTransactionForegroundDispatch M")]
-        [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MR")]
-        [Property("AUTHOR", "Gowtham, gowtham.ab@samsung.com")]
-        public static void EnableTransactionForegroundDispatch_METHOD_CALL_AND_CHECK_SUCCESS()
-        {
-            try
-            {
-                NfcCardEmulationAdapter ceAdapter = NfcManager.GetCardEmulationAdapter();
-
-                /* TEST CODE */
-                ceAdapter.EnableTransactionForegroundDispatch();
-            }
-            catch (NotSupportedException)
-            {
-                Assert.IsTrue(isNfcSupported == false || isCeSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation");
-            }
+        }\r
+\r
+        [Test]\r
+        [Category("P2")]\r
+        [Description("Enable Transaction Foreground Dispatch with not foreground environment, and check Invalid operation exception")]\r
+        [Property("SPEC", "Tizen.Network.Nfc.NfcCardEmulationAdapter.EnableTransactionForegroundDispatch M")]\r
+        [Property("SPEC_URL", "-")]\r
+        [Property("CRITERIA", "MEX")]\r
+        [Property("AUTHOR", "Jihoon, jh8801.jung@samsung.com")]\r
+        public void EnableTransactionForegroundDispatch_CHECK_INVALID_OPERATION_EXCEPTION()\r
+        {\r
+            NfcCardEmulationAdapter ceAdapter = null;\r
+\r
+            try\r
+            {\r
+                ceAdapter = NfcManager.GetCardEmulationAdapter();\r
+                Assert.IsNotNull(ceAdapter, "ceAdapter should not be null");
+\r
+                /* TEST CODE */\r
+                ceAdapter.EnableTransactionForegroundDispatch();\r
+            }\r
+            catch (NotSupportedException)\r
+            {\r
+                Assert.IsTrue(isNfcSupported == false || isCeSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation");\r
+            }\r
+            catch (InvalidOperationException)\r
+            {\r
+                Assert.IsTrue(true, "It is normal operation because the api caller should be on forground, but TC program can't on forgound.");\r
+            }\r
+\r
+            finally\r
+            {\r
+                /* POSTCONDITION\r
+                * 1. Reset variables\r
+                */\r
+\r
+                if (ceAdapter != null)\r
+                {\r
+                    ceAdapter = null;\r
+                }\r
+            }\r
         }
 
         [Test]
@@ -182,7 +201,7 @@ namespace Tizen.Network.Nfc.Tests
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "MAC")]
         [Property("AUTHOR", "Gowtham, gowtham.ab@samsung.com")]
-        public static void RegisterAid_METHOD_CALL_WITH_HCE_PAYMENT()
+        public void RegisterAid_METHOD_CALL_WITH_HCE_PAYMENT()
         {
             try
             {
@@ -190,6 +209,7 @@ namespace Tizen.Network.Nfc.Tests
 
                 /* TEST CODE */
                 ceAdapter.RegisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment, "325041592E5359532E4444463031");
+                ceAdapter.UnregisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment, "325041592E5359532E4444463031");
             }
             catch (NotSupportedException)
             {
@@ -365,7 +385,7 @@ namespace Tizen.Network.Nfc.Tests
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "MEX")]
         [Property("AUTHOR", "Jihoon Jung, jh8801.jung@samsung.com")]
-        public static void RegisterAid_CHECK_NULL_REFERENCE_EXCEPTION()
+        public void RegisterAid_CHECK_NULL_REFERENCE_EXCEPTION()
         {
             /*
             * TEST CODE
@@ -383,6 +403,10 @@ namespace Tizen.Network.Nfc.Tests
             catch (NotSupportedException)
             {
                 Assert.IsTrue(isNfcSupported == false || isHceSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation");
+            }\r
+            catch (Exception ex)\r
+            {\r
+                Assert.True(true, "Null Reference Exception occurs. Msg : " + ex.ToString());\r
             }
         }
 
@@ -393,7 +417,7 @@ namespace Tizen.Network.Nfc.Tests
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "MEX")]
         [Property("AUTHOR", "Jihoon Jung, jh8801.jung@samsung.com")]
-        public static void UnregisterAid_CHECK_NULL_REFERENCE_EXCEPTION()
+        public void UnregisterAid_CHECK_NULL_REFERENCE_EXCEPTION()
         {
             /*
             * TEST CODE
@@ -411,6 +435,10 @@ namespace Tizen.Network.Nfc.Tests
             catch (NotSupportedException)
             {
                 Assert.IsTrue(isNfcSupported == false || isHceSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation");
+            }\r
+            catch (Exception ex)\r
+            {\r
+                Assert.True(true, "Null Reference Exception occurs. Msg : " + ex.ToString());\r
             }
         }
 
@@ -421,7 +449,7 @@ namespace Tizen.Network.Nfc.Tests
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "MAC")]
         [Property("AUTHOR", "Gowtham, gowtham.ab@samsung.com")]
-        public static void GetRegisteredAidInformation_METHOD_RETURN_WITH_HCE()
+        public void GetRegisteredAidInformation_METHOD_RETURN_WITH_HCE()
         {
             try
             {
@@ -432,7 +460,7 @@ namespace Tizen.Network.Nfc.Tests
                 NfcCardEmulationAdapter ceAdapter = NfcManager.GetCardEmulationAdapter();
 
                 ceAdapter.RegisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment, "325041592E5359532E4444463031");
-                ceAdapter.RegisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Other, "325041592E5359532E4444463031");
+                ceAdapter.RegisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Other, "325041592E5359532E44444630312");
 
                 IEnumerable<NfcRegisteredAidInformation> hcePaymentAids1 = ceAdapter.GetRegisteredAidInformation(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment);
                 Assert.IsInstanceOf<IEnumerable<NfcRegisteredAidInformation>>(hcePaymentAids1, "GetRegisteredAidInformation return value is not of the type NfcRegisteredAidInformation");
@@ -448,7 +476,7 @@ namespace Tizen.Network.Nfc.Tests
                 Assert.IsInstanceOf<IEnumerable<NfcRegisteredAidInformation>>(hceOtherAids1, "GetRegisteredAidInformation return value is not of the type NfcRegisteredAidInformation");
                 foreach (NfcRegisteredAidInformation aidInformation in hceOtherAids1)
                 {
-                    Assert.IsTrue(aidInformation.Aid == "325041592E5359532E4444463031", "aid is not equal to PPSE aid");
+                    Assert.IsTrue(aidInformation.Aid == "325041592E5359532E44444630312", "aid is not equal to PPSE aid");
                     Assert.IsTrue(aidInformation.SeType == NfcSecureElementType.Hce, "se type is not equal to HCE");
 
                     hceOtherAidsCount++;
@@ -461,7 +489,7 @@ namespace Tizen.Network.Nfc.Tests
                 hceOtherAidsCount = 0;
 
                 ceAdapter.UnregisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment, "325041592E5359532E4444463031");
-                ceAdapter.UnregisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Other, "325041592E5359532E4444463031");
+                ceAdapter.UnregisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Other, "325041592E5359532E44444630312");
 
                 IEnumerable<NfcRegisteredAidInformation> hcePaymentAids2 = ceAdapter.GetRegisteredAidInformation(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment);
                 foreach (NfcRegisteredAidInformation aidInformation in hcePaymentAids2)
@@ -490,7 +518,7 @@ namespace Tizen.Network.Nfc.Tests
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "MAC")]
         [Property("AUTHOR", "Gowtham, gowtham.ab@samsung.com")]
-        public static void GetRegisteredAidInformation_METHOD_RETURN_WITH_ESE()
+        public void GetRegisteredAidInformation_METHOD_RETURN_WITH_ESE()
         {
             try
             {
@@ -501,7 +529,7 @@ namespace Tizen.Network.Nfc.Tests
                 NfcCardEmulationAdapter ceAdapter = NfcManager.GetCardEmulationAdapter();
 
                 ceAdapter.RegisterAid(NfcSecureElementType.EmbeddedSE, NfcCardEmulationCategoryType.Payment, "325041592E5359532E4444463031");
-                ceAdapter.RegisterAid(NfcSecureElementType.EmbeddedSE, NfcCardEmulationCategoryType.Other, "325041592E5359532E4444463031");
+                ceAdapter.RegisterAid(NfcSecureElementType.EmbeddedSE, NfcCardEmulationCategoryType.Other, "325041592E5359532E44444630312");
 
                 IEnumerable<NfcRegisteredAidInformation> esePaymentAids1 = ceAdapter.GetRegisteredAidInformation(NfcSecureElementType.EmbeddedSE, NfcCardEmulationCategoryType.Payment);
                 Assert.IsInstanceOf<IEnumerable<NfcRegisteredAidInformation>>(esePaymentAids1, "GetRegisteredAidInformation return value is not of the type NfcRegisteredAidInformation");
@@ -518,7 +546,7 @@ namespace Tizen.Network.Nfc.Tests
                 Assert.IsInstanceOf<IEnumerable<NfcRegisteredAidInformation>>(eseOtherAids1, "GetRegisteredAidInformation return value is not of the type NfcRegisteredAidInformation");
                 foreach (NfcRegisteredAidInformation aidInformation in eseOtherAids1)
                 {
-                    Assert.IsTrue(aidInformation.Aid == "325041592E5359532E4444463031", "aid is not equal to PPSE aid");
+                    Assert.IsTrue(aidInformation.Aid == "325041592E5359532E44444630312", "aid is not equal to PPSE aid");
                     Assert.IsTrue(aidInformation.SeType == NfcSecureElementType.EmbeddedSE, "se type is not equal to HCE");
 
                     eseOtherAidsCount++;
@@ -531,7 +559,7 @@ namespace Tizen.Network.Nfc.Tests
                 eseOtherAidsCount = 0;
 
                 ceAdapter.UnregisterAid(NfcSecureElementType.EmbeddedSE, NfcCardEmulationCategoryType.Payment, "325041592E5359532E4444463031");
-                ceAdapter.UnregisterAid(NfcSecureElementType.EmbeddedSE, NfcCardEmulationCategoryType.Other, "325041592E5359532E4444463031");
+                ceAdapter.UnregisterAid(NfcSecureElementType.EmbeddedSE, NfcCardEmulationCategoryType.Other, "325041592E5359532E44444630312");
 
                 IEnumerable<NfcRegisteredAidInformation> esePaymentAids2 = ceAdapter.GetRegisteredAidInformation(NfcSecureElementType.EmbeddedSE, NfcCardEmulationCategoryType.Payment);
                 foreach (NfcRegisteredAidInformation aidInformation in esePaymentAids2)
@@ -571,11 +599,15 @@ namespace Tizen.Network.Nfc.Tests
 
                 /* TEST CODE */
                 ceAdapter.GetRegisteredAidInformation(0, 0);
-                Assert.Fail( "ForeachRegisteredAidInformations method should be make the exception");
+                Assert.Fail("ForeachRegisteredAidInformations method should be make the exception");
             }
             catch (NotSupportedException)
             {
                 Assert.IsTrue(isNfcSupported == false || isHceSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation");
+            }\r
+            catch (Exception ex)\r
+            {\r
+                Assert.True(true, "Null Reference Exception occurs. Msg : " + ex.ToString());\r
             }
         }
     }
index 1b53cabb831a6bab25042536dca04434e52de418..581a0235677b5c306494b5acc654a58bb7eda72c 100755 (executable)
@@ -89,6 +89,7 @@ namespace Tizen.Network.Nfc.Tests
                 {
                     Assert.IsTrue(aidInformation.Aid == "325041592E5359532E4444463031", "Aid property is not proper value");
                 }
+                ceAdapter.UnregisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment, "325041592E5359532E4444463031");
             }
             catch (NotSupportedException)
             {
@@ -118,6 +119,7 @@ namespace Tizen.Network.Nfc.Tests
                 {
                     Assert.IsTrue(aidInformation.ReadOnly == false, "ReadOnly property should be false");
                 }
+                ceAdapter.UnregisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment, "325041592E5359532E4444463031");
             }
             catch (NotSupportedException)
             {
@@ -147,6 +149,7 @@ namespace Tizen.Network.Nfc.Tests
                 {
                     Assert.IsTrue(aidInformation.SeType == NfcSecureElementType.Hce, "SeType property should be Hce");
                 }
+                ceAdapter.UnregisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment, "325041592E5359532E4444463031");
             }
             catch (NotSupportedException)
             {