[Applications][Non-ACR][Fix testcases for iot profile] 74/239474/1
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 27 Jul 2020 04:54:02 +0000 (13:54 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 27 Jul 2020 04:54:43 +0000 (13:54 +0900)
- Use service app instead of ui app

Change-Id: I9d16fc3d7a27ca5dcf7476d99f00af6d78c0effe
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
tct-suite-vs/Tizen.Applications.Tests/testcase/TSApplicationLaunchedEventArgs.cs
tct-suite-vs/Tizen.Applications.Tests/testcase/TSApplicationManager.cs

index 341f3c0..66937fb 100755 (executable)
@@ -1,5 +1,6 @@
 using NUnit.Framework;
 using NUnit.Framework.TUnit;
+using System.Linq.Expressions;
 using System.Threading.Tasks;
 
 namespace Tizen.Applications.Tests
@@ -13,7 +14,7 @@ namespace Tizen.Applications.Tests
         private bool _needUnsubscribe;
         private bool _isLaunched;
         private string _argAppId;
-        private const string AppId = "org.tizen.example.UIApp.Tizen";
+        private const string AppId = "org.tizen.ServiceAppTest.Tizen";
 
         [SetUp]
         public void Init()
@@ -63,6 +64,17 @@ namespace Tizen.Applications.Tests
         [Property("AUTHOR", "Sangyoon Jang, s89.jang@samsung.com")]
         public async Task ApplicationRunningContext_ATTR()
         {
+            try
+            {
+                var runningContext = new ApplicationRunningContext(AppId);
+                if (runningContext != null)
+                    ApplicationManager.TerminateBackgroundApplication(runningContext);
+            }
+            catch
+            {
+                Log.Debug("TCT", AppId + " is not running");
+            }
+
             var IsRunning = false;
             ApplicationManager.ApplicationLaunched += Eventlaunched;
             _needUnsubscribe = true;
@@ -80,6 +92,7 @@ namespace Tizen.Applications.Tests
                 if (app.ApplicationId.Contains(AppId))
                 {
                     IsRunning = true;
+                    ApplicationManager.TerminateBackgroundApplication(app);
                     break;
                 }
             }
@@ -93,11 +106,6 @@ namespace Tizen.Applications.Tests
             Assert.AreEqual(_argAppId, AppId, "Application ID launch is not correct");
             Assert.Greater(_processId, 0, "Process ID is not correct");
             Assert.True(_isLaunched, "Eventlaunched should be occurred");
-
-            if (IsRunning)
-            {
-                AppControl.SendTerminateRequest(appControl);
-            }
         }
     }
 }
index a861732..61c5248 100755 (executable)
@@ -240,11 +240,11 @@ namespace Tizen.Applications.Tests
 
         public void Eventlaunched(object sender, ApplicationLaunchedEventArgs Args)
         {
-            if (string.Equals(Args.ApplicationRunningContext.ApplicationId, AppId))\r
-            {\r
-                _argAppId = Args.ApplicationRunningContext.ApplicationId;\r
+            if (string.Equals(Args.ApplicationRunningContext.ApplicationId, AppServiceId))
+            {
+                _argAppId = Args.ApplicationRunningContext.ApplicationId;
                 _processId = Args.ApplicationRunningContext.ProcessId;
-                _isLaunched = true;\r
+                _isLaunched = true;
             }
         }
 
@@ -261,8 +261,7 @@ namespace Tizen.Applications.Tests
             ApplicationManager.ApplicationLaunched += Eventlaunched;
             _needUnsubscribe1 = true;
             AppControl appControl = new AppControl();
-            appControl.ApplicationId = AppId;
-            appControl.LaunchMode = AppControlLaunchMode.Group;
+            appControl.ApplicationId = AppServiceId;
             _argAppId = "";
             _processId = 0;
 
@@ -271,9 +270,10 @@ namespace Tizen.Applications.Tests
             var _list = await ApplicationManager.GetAllRunningApplicationsAsync();
             foreach (var app in _list)
             {
-                if (app.ApplicationId.Contains(AppId))
+                if (app.ApplicationId.Contains(AppServiceId))
                 {
                     IsRunning = true;
+                    ApplicationManager.TerminateBackgroundApplication(app);
                     break;
                 }
             }
@@ -284,14 +284,9 @@ namespace Tizen.Applications.Tests
              * 4 Close Message App after this app lauched.
              * 4 Check bFlag is true.
              */
-            Assert.AreEqual(_argAppId, AppId, "Application ID launch is not correct");
+            Assert.AreEqual(_argAppId, AppServiceId, "Application ID launch is not correct");
             Assert.Greater(_processId, 0, "Process ID is not correct");
             Assert.True(_isLaunched, "Eventlaunched should be occurred");
-
-            if (IsRunning)
-            {
-                AppControl.SendTerminateRequest(appControl);
-            }
         }
 
         public void EventTerminated(object sender, ApplicationTerminatedEventArgs Args)