[Tizen.System.PowerUsage.Tests][TCSACR-310]Addition of Tizen.System.PowerUsage.Tests 07/232307/2
authorsri <v.pogiri@samsung.com>
Thu, 30 Apr 2020 10:01:02 +0000 (15:31 +0530)
committerchakradhar pogiri <v.pogiri@samsung.com>
Wed, 6 May 2020 04:36:22 +0000 (04:36 +0000)
Change-Id: I0fdd25e4966310f72e173243493b05f0207b844a

tct-suite-vs/Tizen.System.PowerUsage.Tests/Program.cs [new file with mode: 0755]
tct-suite-vs/Tizen.System.PowerUsage.Tests/Tizen.System.PowerUsage.Tests.csproj [new file with mode: 0755]
tct-suite-vs/Tizen.System.PowerUsage.Tests/Tizen.System.PowerUsage.Tests.sln [new file with mode: 0755]
tct-suite-vs/Tizen.System.PowerUsage.Tests/shared/res/Tizen.System.PowerUsage.Tests.png [new file with mode: 0755]
tct-suite-vs/Tizen.System.PowerUsage.Tests/testcase/TSPowerUsage.cs [new file with mode: 0755]
tct-suite-vs/Tizen.System.PowerUsage.Tests/tizen-manifest.xml [new file with mode: 0755]

diff --git a/tct-suite-vs/Tizen.System.PowerUsage.Tests/Program.cs b/tct-suite-vs/Tizen.System.PowerUsage.Tests/Program.cs
new file mode 100755 (executable)
index 0000000..87d9f97
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using System;
+using NUnitLite.TUnit;
+using AutoTemplate;
+
+namespace XamarinForTizen.Tizen
+{
+
+    class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+    {
+        private static App _app;
+        protected override void OnCreate()
+        {
+            base.OnCreate();
+
+            Console.WriteLine("TCT : OnCreate()");
+            _app = new App();
+            LoadApplication(_app);
+
+            TRunner t = new TRunner();
+            t.LoadTestsuite();
+            t.Execute();
+        }
+
+        public static App getApp()
+        {
+            return _app;
+        }
+        static void Main(string[] args)
+        {
+            Console.WriteLine("TCT : Main()");
+            var app = new Program();
+            global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
+            app.Run(args);
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.System.PowerUsage.Tests/Tizen.System.PowerUsage.Tests.csproj b/tct-suite-vs/Tizen.System.PowerUsage.Tests/Tizen.System.PowerUsage.Tests.csproj
new file mode 100755 (executable)
index 0000000..ed82ea6
--- /dev/null
@@ -0,0 +1,39 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <!-- Property Group for .NET Core Project -->
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>tizen70</TargetFramework>
+  </PropertyGroup>
+
+  <!-- Property Group for Tizen Project -->
+  <PropertyGroup>
+    <TizenCreateTpkOnBuild>true</TizenCreateTpkOnBuild>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugType>portable</DebugType>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>None</DebugType>
+  </PropertyGroup>
+
+  <ItemGroup>
+       <Folder Include="lib\" />
+  </ItemGroup>
+
+  <Import Project="..\Common\dependencies.props" />
+
+  <ItemGroup>
+    <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)">
+      <ExcludeAssets>Runtime</ExcludeAssets>
+    </PackageReference>
+    <PackageReference Include="Tizen.NET.Sdk" Version="$(TizenNETSdkVersion)" />
+  </ItemGroup>
+
+  <!-- Include Nuget Package for Tizen Project building -->
+  <ItemGroup>
+    <ProjectReference Include="..\Template\AutoTemplate\AutoTemplate.csproj" />
+  </ItemGroup>
+
+</Project>
diff --git a/tct-suite-vs/Tizen.System.PowerUsage.Tests/Tizen.System.PowerUsage.Tests.sln b/tct-suite-vs/Tizen.System.PowerUsage.Tests/Tizen.System.PowerUsage.Tests.sln
new file mode 100755 (executable)
index 0000000..13afb17
--- /dev/null
@@ -0,0 +1,78 @@
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.26730.15\r
+MinimumVisualStudioVersion = 15.0.26124.0\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.PowerUsage.Tests", "Tizen.System.PowerUsage.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+               Debug|Any CPU = Debug|Any CPU\r
+               Debug|x64 = Debug|x64\r
+               Debug|x86 = Debug|x86\r
+               Release|Any CPU = Release|Any CPU\r
+               Release|x64 = Release|x64\r
+               Release|x86 = Release|x86\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU\r
+               {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU\r
+               {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU\r
+               {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU\r
+               {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU\r
+       EndGlobalSection\r
+       GlobalSection(SolutionProperties) = preSolution\r
+               HideSolutionNode = FALSE\r
+       EndGlobalSection\r
+       GlobalSection(ExtensibilityGlobals) = postSolution\r
+               SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/tct-suite-vs/Tizen.System.PowerUsage.Tests/shared/res/Tizen.System.PowerUsage.Tests.png b/tct-suite-vs/Tizen.System.PowerUsage.Tests/shared/res/Tizen.System.PowerUsage.Tests.png
new file mode 100755 (executable)
index 0000000..9765b1b
Binary files /dev/null and b/tct-suite-vs/Tizen.System.PowerUsage.Tests/shared/res/Tizen.System.PowerUsage.Tests.png differ
diff --git a/tct-suite-vs/Tizen.System.PowerUsage.Tests/testcase/TSPowerUsage.cs b/tct-suite-vs/Tizen.System.PowerUsage.Tests/testcase/TSPowerUsage.cs
new file mode 100755 (executable)
index 0000000..49ea41d
--- /dev/null
@@ -0,0 +1,508 @@
+/*
+ *  Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Collections.Generic;\r
+\r
+namespace Tizen.System.Tests\r
+{
+
+    [TestFixture]
+    [Description("Tizen.System.PowerUsage Class Tests")]
+    public class PowerUsageTests\r
+    {
+        static bool support = true;
+        static DateTime startTime = DateTime.Now.AddDays(-2);
+        static DateTime endTime = DateTime.Now.AddDays(-1);
+        static string appID = "Tizen.System.PowerUsage.Tests";
+
+        [SetUp]
+        public void Init()
+        {
+            bool ret;
+            bool value;
+            ret = Information.TryGetValue<bool>("http://tizen.org/feature/battery", out value);
+            if (ret && value)
+                support = true;
+            else
+                support = false;
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check if GetPowerUsage() return proper value")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByAppForAllResources_CHECK_RESULT()
+        {\r
+            if (support)
+            {\r
+                try\r
+                {\r
+                    object powerUsage;\r
+                    IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();\r
+                    rtypes.Add(PowerUsageResourceType.Cpu);\r
+                    IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);\r
+\r
+                    foreach (PowerUsageResourceType type in rtypes)\r
+                    {\r
+                        powerUsage = result[type];\r
+                        Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value in double for the resources specified by the application in custom interval");\r
+                        Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value for the resources specified by the application in custom interval");\r
+                    }\r
+                }\r
+                catch (Exception e)\r
+                {\r
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());\r
+                    Assert.IsTrue(false, e.ToString());\r
+                }
+            }
+            else\r
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises not supported exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByAppForAllResources_CHECK_NOT_SUPPORTED_EXCEPTION()
+        {\r
+            if (support)
+            {
+                Assert.Pass("Test skipped! Can't test not supported exception");
+            }
+            else
+            {\r
+                try\r
+                {\r
+                    IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();\r
+                    foreach (PowerUsageResourceType rtype in Enum.GetValues(typeof(PowerUsageResourceType)))\r
+                    {\r
+                        rtypes.Add(rtype);\r
+                    }\r
+                    IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);\r
+                    Assert.IsTrue(false, "This operation should raise NotSupportedException");\r
+                }\r
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");\r
+                }\r
+            }\r
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises argument exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByAppForAllResources_CHECK_ARGUMENT_EXCEPTION()
+        {\r
+            if (support)
+            {
+                try\r
+                {\r
+                    IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();\r
+                    rtypes.Add(PowerUsageResourceType.Cpu);\r
+                    IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));\r
+                    Assert.IsTrue(false, "This operation should raise ArgumentException");\r
+                }
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");\r
+                }
+            }
+            else
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }\r
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises invalid operation exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByAppForAllResources_CHECK_INVALID_OPERATION_EXCEPTION()\r
+        {\r
+            if (support)\r
+            {\r
+                try\r
+                {\r
+                    IList<PowerUsageResourceType> rtypes = new List<PowerUsageResourceType>();\r
+                    rtypes.Add(PowerUsageResourceType.Cpu);\r
+                    IDictionary<PowerUsageResourceType, double> result = PowerUsage.GetPowerUsage(appID, rtypes, startTime, endTime);\r
+                    Assert.Pass("Test skipped! since no system error occured to test Invalid operation");\r
+                }\r
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");\r
+                }\r
+            }\r
+            else\r
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }\r
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check if GetPowerUsage() return proper value")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByAppPerResource_CHECK_RESULT()
+        {
+            if (support)\r
+            {\r
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, startTime, endTime);\r
+                    Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value in double for the specific resource for the given application in custom interval");\r
+                    Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value for the specific resource for the given application in custom interval");\r
+                }\r
+                catch (Exception e)\r
+                {\r
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());\r
+                    Assert.IsTrue(false, e.ToString());\r
+                }\r
+            }\r
+            else\r
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises not supported exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByAppPerResource_CHECK_NOT_SUPPORTED_EXCEPTION()
+        {\r
+            if (support)
+            {
+                Assert.Pass("Test skipped! Can't test not supported exception");
+            }
+            else
+            {\r
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, startTime, endTime);\r
+                    Assert.IsTrue(false, "This operation should raise NotSupportedException");\r
+                }\r
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");\r
+                }\r
+            }\r
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises argument exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByAppPerResource_CHECK_ARGUMENT_EXCEPTION()
+        {\r
+            if (support)
+            {
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));\r
+                    Assert.IsTrue(false, "This operation should raise ArgumentException");\r
+                }
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");\r
+                }
+            }
+            else
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }\r
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises invalid operation exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByAppPerResource_CHECK_INVALID_OPERATION_EXCEPTION()\r
+        {\r
+            if (support)\r
+            {\r
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(appID, PowerUsageResourceType.Cpu, startTime, endTime);\r
+                    Assert.Pass("Test skipped! since no system error occured to test Invalid operation");\r
+                }\r
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");\r
+                }\r
+            }\r
+            else\r
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }\r
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check if GetPowerUsage() return proper value")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByApp_CHECK_RESULT()
+        {
+            if (support)\r
+            {\r
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(appID, startTime, endTime);\r
+                    Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value corresponding to app in double");\r
+                    Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value corresponding to app");\r
+                }\r
+                catch (Exception e)\r
+                {\r
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());\r
+                    Assert.IsTrue(false, e.ToString());\r
+                }\r
+            }
+            else\r
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }
+        }\r
+\r
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises not supported exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByApp_CHECK_NOT_SUPPORTED_EXCEPTION()
+        {\r
+            if (support)
+            {
+                Assert.Pass("Test skipped! Can't test not supported exception");
+            }
+            else
+            {\r
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(appID, startTime, endTime);\r
+                    Assert.IsTrue(false, "This operation should raise NotSupportedException");\r
+                }\r
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");\r
+                }\r
+            }\r
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises argument exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByApp_CHECK_ARGUMENT_EXCEPTION()
+        {\r
+            if (support)
+            {
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(appID, DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));\r
+                    Assert.IsTrue(false, "This operation should raise ArgumentException");\r
+                }
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");\r
+                }
+            }
+            else
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }\r
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises invalid operation exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByApp_CHECK_INVALID_OPERATION_EXCEPTION()\r
+        {\r
+            if (support)\r
+            {\r
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(appID, startTime, endTime);\r
+                    Assert.Pass("Test skipped! since no system error occured to test Invalid operation");\r
+                }\r
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");\r
+                }\r
+            }\r
+            else\r
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }\r
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check if GetPowerUsage() return proper value")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByResource_CHECK_RESULT()
+        {
+            if (support)\r
+            {\r
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, startTime, endTime);\r
+                    Assert.IsTrue(powerUsage is double, "GetPowerUsage() should return power usage value in double by a resource for certain time interval");\r
+                    Assert.IsTrue((double)powerUsage >= 0, "GetPowerUsage() should return usage value by a resource for certain time interval");\r
+                }\r
+                catch (Exception e)\r
+                {\r
+                    LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, e.ToString());\r
+                    Assert.IsTrue(false, e.ToString());\r
+                }\r
+            }
+            else\r
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises not supported exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByResource_CHECK_NOT_SUPPORTED_EXCEPTION()
+        {\r
+            if (support)
+            {
+                Assert.Pass("Test skipped! Can't test not supported exception");
+            }
+            else
+            {\r
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, startTime, endTime);\r
+                    Assert.IsTrue(false, "This operation should raise NotSupportedException");\r
+                }\r
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(NotSupportedException), "This operation should raise NotSupportedException");\r
+                }\r
+            }\r
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises argument exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByResource_CHECK_ARGUMENT_EXCEPTION()
+        {\r
+            if (support)
+            {
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, DateTime.Now.AddDays(1), DateTime.Now.AddDays(2));\r
+                    Assert.IsTrue(false, "This operation should raise ArgumentException");\r
+                }
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(ArgumentException), "this operation should raise ArgumentException exception");\r
+                }
+            }
+            else
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }\r
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if GetPowerUsage() raises invalid operation exception")]
+        [Property("SPEC", "Tizen.System.PowerUsage.GetPowerUsage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Venkata Sai Chakradhar Pogiri, v.pogiri@samsung.com")]
+        public void GetPowerUsageByResource_CHECK_INVALID_OPERATION_EXCEPTION()\r
+        {\r
+            if (support)\r
+            {\r
+                try\r
+                {\r
+                    object powerUsage = PowerUsage.GetPowerUsage(PowerUsageResourceType.Cpu, startTime, endTime);\r
+                    Assert.Pass("Test skipped! since no system error occured to test Invalid operation");\r
+                }\r
+                catch (Exception ex)\r
+                {\r
+                    Assert.IsTrue(ex.GetType() == typeof(InvalidOperationException), "This operation will raise InvalidOperationException incase of any system error");\r
+                }\r
+            }\r
+            else\r
+            {\r
+                Assert.Pass("Test skipped! Can't test due to not supported exception");\r
+            }\r
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.System.PowerUsage.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.System.PowerUsage.Tests/tizen-manifest.xml
new file mode 100755 (executable)
index 0000000..c81437d
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="7" package="Tizen.System.PowerUsage.Tests" version="1.0.0">
+    <profile name="common" />
+    <ui-application appid="Tizen.System.PowerUsage.Tests"
+                    exec="Tizen.System.PowerUsage.Tests.dll"
+                    type="dotnet"
+                    multiple="false"
+                    taskmanage="true"
+                    launch_mode="single">
+    <icon>Tizen.System.PowerUsage.Tests.png</icon>
+    <label>Tizen.System.PowerUsage.Tests</label>
+    </ui-application>
+    <privileges>
+        <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+        <privilege>http://tizen.org/privilege/systemmonitor</privilege>
+    </privileges>
+</manifest>