From: Jihoon Jung Date: Thu, 27 Dec 2018 22:56:03 +0000 (+0900) Subject: [NFC][Non-ACR][Change TC for change NFC Csharp implementation] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=849442dbd734a053d5e4ee1ca112ae698552f0b0;p=test%2Ftct%2Fcsharp%2Fapi.git [NFC][Non-ACR][Change TC for change NFC Csharp implementation] - 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 --- diff --git a/tct-suite-vs/Tizen.Nfc.Manual.Tests/testcase/TSNfcCardEmulationAdapter.cs b/tct-suite-vs/Tizen.Nfc.Manual.Tests/testcase/TSNfcCardEmulationAdapter.cs index 16cbdd6f6..741ac1591 100755 --- a/tct-suite-vs/Tizen.Nfc.Manual.Tests/testcase/TSNfcCardEmulationAdapter.cs +++ b/tct-suite-vs/Tizen.Nfc.Manual.Tests/testcase/TSNfcCardEmulationAdapter.cs @@ -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"); + + /* TEST CODE */ + _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) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + + finally + { + /* POSTCONDITION + * 1. Reset variables + */ + + if (_cardEmulationAdapter != null) + { + _cardEmulationAdapter = null; + } + } + } } } diff --git a/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcCardEmulationAdapter.cs b/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcCardEmulationAdapter.cs index 22d8d19fb..ddfbf8ff7 100755 --- a/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcCardEmulationAdapter.cs +++ b/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcCardEmulationAdapter.cs @@ -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"); - } + } + + [Test] + [Category("P2")] + [Description("Enable Transaction Foreground Dispatch with not foreground environment, and check Invalid operation exception")] + [Property("SPEC", "Tizen.Network.Nfc.NfcCardEmulationAdapter.EnableTransactionForegroundDispatch M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jihoon, jh8801.jung@samsung.com")] + public void EnableTransactionForegroundDispatch_CHECK_INVALID_OPERATION_EXCEPTION() + { + NfcCardEmulationAdapter ceAdapter = null; + + try + { + ceAdapter = NfcManager.GetCardEmulationAdapter(); + Assert.IsNotNull(ceAdapter, "ceAdapter should not be null"); + + /* TEST CODE */ + ceAdapter.EnableTransactionForegroundDispatch(); + } + catch (NotSupportedException) + { + Assert.IsTrue(isNfcSupported == false || isCeSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation"); + } + catch (InvalidOperationException) + { + Assert.IsTrue(true, "It is normal operation because the api caller should be on forground, but TC program can't on forgound."); + } + + finally + { + /* POSTCONDITION + * 1. Reset variables + */ + + if (ceAdapter != null) + { + ceAdapter = null; + } + } } [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"); + } + catch (Exception ex) + { + Assert.True(true, "Null Reference Exception occurs. Msg : " + ex.ToString()); } } @@ -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"); + } + catch (Exception ex) + { + Assert.True(true, "Null Reference Exception occurs. Msg : " + ex.ToString()); } } @@ -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 hcePaymentAids1 = ceAdapter.GetRegisteredAidInformation(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Payment); Assert.IsInstanceOf>(hcePaymentAids1, "GetRegisteredAidInformation return value is not of the type NfcRegisteredAidInformation"); @@ -448,7 +476,7 @@ namespace Tizen.Network.Nfc.Tests Assert.IsInstanceOf>(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 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 esePaymentAids1 = ceAdapter.GetRegisteredAidInformation(NfcSecureElementType.EmbeddedSE, NfcCardEmulationCategoryType.Payment); Assert.IsInstanceOf>(esePaymentAids1, "GetRegisteredAidInformation return value is not of the type NfcRegisteredAidInformation"); @@ -518,7 +546,7 @@ namespace Tizen.Network.Nfc.Tests Assert.IsInstanceOf>(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 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"); + } + catch (Exception ex) + { + Assert.True(true, "Null Reference Exception occurs. Msg : " + ex.ToString()); } } } diff --git a/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcRegisteredAidInformation.cs b/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcRegisteredAidInformation.cs index 1b53cabb8..581a02356 100755 --- a/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcRegisteredAidInformation.cs +++ b/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcRegisteredAidInformation.cs @@ -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) {