[Non-ACR][Framework][Manual][Fix only load not pass testcases] 77/200377/1
authorraycad <anh.vn@samsung.com>
Fri, 22 Feb 2019 10:31:00 +0000 (17:31 +0700)
committerraycad <anh.vn@samsung.com>
Fri, 22 Feb 2019 10:31:00 +0000 (17:31 +0700)
Change-Id: Ie0d3a5c447fad500e78119ce22019ef7ebbb5ad0

tct-suite-vs/Template/ManualTemplate/ManualTemplate.cs
tct-suite-vs/Template/ManualTemplate/TestPage.cs
tct-suite-vs/Template/ManualTemplateForWearable/ManualTemplate.cs
tct-suite-vs/Template/ManualTemplateForWearable/TestPage.cs
tct-suite-vs/nunit.framework/TUnit/TSettings.cs

index f9dfe9373fcec3794a2f04b2a06203ebd5be2a63..78b0aafa2b3f13e048e71150e065cb4ca3bb151b 100755 (executable)
@@ -25,6 +25,7 @@ namespace ManualTemplate
         private Label _summaryLabel;
         private ListView _listView;
         private StackLayout _mainLayout;
+        private List<string> _listNotPass;\r
 
 
         public static MainPage GetInstance()
@@ -44,15 +45,18 @@ namespace ManualTemplate
         public MainPage()
         {
             _tunitrunner = new TRunner();
-            _tunitrunner.LoadTestsuite();
+            _tunitrunner.LoadTestsuite();\r
+            _listNotPass = new List<string>();
             _tcIDList = new List<string>();
             _listItem = new List<ItemData>();
+            _listNotPass = TSettings.GetInstance().GetNotPassListManual();
+
             int count = 0;
-            foreach (KeyValuePair<string, ITest> pair in _tunitrunner.GetTestList())
+            foreach (var tc in _listNotPass)
             {
                 count++;
-                _listItem.Add(new ItemData { No = count, TCName = pair.Key, Result = StrResult.NOTRUN });
-                _tcIDList.Add(pair.Key);
+                _listItem.Add(new ItemData { No = count, TCName = tc, Result = StrResult.NOTRUN });
+                _tcIDList.Add(tc);
             }
 
             ResultNumber.Total = ResultNumber.NotRun = _tcIDList.Count;
index 11b82cf9a78226797fa3a44b4fe8e40d38008147..9f6c39e87ea41e60a63a5c844709002f473c7473 100755 (executable)
@@ -93,7 +93,7 @@ namespace NUnit.Framework
             _tcIDList = testcaseIDList;
             _tsettings = TSettings.GetInstance();
             _tsettings.IsManual = true;
-            _listItem = listItem;
+            _listItem = listItem;\r
             MakeTCInfoList();
             _summaryLabel = new Label()
             {
@@ -569,36 +569,43 @@ namespace NUnit.Framework
 
         private void MakeTCInfoList()
         {
-            foreach (KeyValuePair<string, ITest> pair in _tunitRunner.GetTestList())
-            {
-                IEnumerator<CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();
-                List<string> _preconditonsStr = new List<string>(); _preconditonsStr.Add("Preconditions:");
-                List<string> _stepsStr = new List<string>(); _stepsStr.Add("Steps:");
-                List<string> _postconditionsStr = new List<string>(); _postconditionsStr.Add("Postconditions:\n");
-
-                while (customAttributes.MoveNext())
-                {
-                    if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))
-                    {
-                        _stepsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
-                    }
-                    else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))
-                    {
-                        _preconditonsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
-                    }
-                    else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))
-                    {
-                        _postconditionsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
-                    }
+            foreach (var testcaseItem in _listItem)
+            {\r
+                foreach (KeyValuePair<string, ITest> pair in _tunitRunner.GetTestList())\r
+                {\r
+                    if (testcaseItem.TCName.Equals(pair.Key))\r
+                    {\r
+                        IEnumerator<CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();\r
+                        List<string> _preconditonsStr = new List<string>(); _preconditonsStr.Add("Preconditions:");\r
+                        List<string> _stepsStr = new List<string>(); _stepsStr.Add("Steps:");\r
+                        List<string> _postconditionsStr = new List<string>(); _postconditionsStr.Add("Postconditions:\n");\r
+\r
+                        while (customAttributes.MoveNext())\r
+                        {\r
+                            if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))\r
+                            {\r
+                                _stepsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
+                            }\r
+                            else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))\r
+                            {\r
+                                _preconditonsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
+                            }\r
+                            else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))\r
+                            {\r
+                                _postconditionsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
+                            }\r
+                        }\r
+\r
+                        _tcInfoList.Add(new TestcaseInfo\r
+                        {\r
+                            TestcaseName = pair.Key,\r
+                            Preconditions = _preconditonsStr,\r
+                            Steps = _stepsStr,\r
+                            Postconditions = _postconditionsStr,\r
+                        });\r
+                        break;\r
+                    }\r
                 }
-
-                _tcInfoList.Add(new TestcaseInfo
-                {
-                    TestcaseName = pair.Key,
-                    Preconditions = _preconditonsStr,
-                    Steps = _stepsStr,
-                    Postconditions = _postconditionsStr,
-                });
             }
         }
 
index 4ca4df1ed1be30b6d6de019bb71e8cfd9023b572..a4cff8b550de199f7dde5893d71af38492824206 100755 (executable)
@@ -22,6 +22,7 @@ namespace WearableTemplate
         private Label _summaryLabel1, _summaryLabel2;
         private ListView _listView;
         private StackLayout _mainLayout;
+        private List<string> _listNotPass;
 
 
         public static MainPage GetInstance()
@@ -42,14 +43,17 @@ namespace WearableTemplate
         {
             _tunitrunner = new TRunner();
             _tunitrunner.LoadTestsuite();
+            _listNotPass = new List<string>();
             _tcIDList = new List<string>();
             _listItem = new List<ItemData>();
+            _listNotPass = TSettings.GetInstance().GetNotPassListManual();
+
             int count = 0;
-            foreach (KeyValuePair<string, ITest> pair in _tunitrunner.GetTestList())
+            foreach (var tc in _listNotPass)
             {
                 count++;
-                _listItem.Add(new ItemData { No = count, TCName = pair.Key, Result = StrResult.NOTRUN });
-                _tcIDList.Add(pair.Key);
+                _listItem.Add(new ItemData { No = count, TCName = tc, Result = StrResult.NOTRUN });
+                _tcIDList.Add(tc);
             }
 
             ResultNumber.Total = ResultNumber.NotRun = _tcIDList.Count;
index f9c9cd9c0f1de38644a0eba84656563a108fc068..2d65e32232ef7801182cdd728b833a3f1a374d9c 100755 (executable)
@@ -593,36 +593,43 @@ namespace WearableTemplate
 
         private void MakeTCInfoList()
         {
-            foreach (KeyValuePair<string, ITest> pair in _tunitRunner.GetTestList())
+            foreach (var testcaseItem in _listItem)
             {
-                IEnumerator<CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();
-                List<string> _preconditonsStr = new List<string>(); _preconditonsStr.Add("Preconditions:");
-                List<string> _stepsStr = new List<string>(); _stepsStr.Add("Steps:");
-                List<string> _postconditionsStr = new List<string>(); _postconditionsStr.Add("Postconditions:\n");
-
-                while (customAttributes.MoveNext())
+                foreach (KeyValuePair<string, ITest> pair in _tunitRunner.GetTestList())
                 {
-                    if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))
-                    {
-                        _stepsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
-                    }
-                    else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))
+                    if (testcaseItem.TCName.Equals(pair.Key))
                     {
-                        _preconditonsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
-                    }
-                    else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))
-                    {
-                        _postconditionsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);
+                        IEnumerator<CustomAttributeData> customAttributes = pair.Value.Method.MethodInfo.CustomAttributes.GetEnumerator();
+                        List<string> _preconditonsStr = new List<string>(); _preconditonsStr.Add("Preconditions:");
+                        List<string> _stepsStr = new List<string>(); _stepsStr.Add("Steps:");
+                        List<string> _postconditionsStr = new List<string>(); _postconditionsStr.Add("Postconditions:\n");\r
+\r
+                        while (customAttributes.MoveNext())\r
+                        {\r
+                            if (customAttributes.Current.AttributeType.FullName.Equals(STEP_ATTRIBUTE_NAME))\r
+                            {\r
+                                _stepsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
+                            }\r
+                            else if (customAttributes.Current.AttributeType.FullName.Equals(PRECONDITION_ATTRIBUTE_NAME))\r
+                            {\r
+                                _preconditonsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
+                            }\r
+                            else if (customAttributes.Current.AttributeType.FullName.Equals(POSTCONDITION_ATTRIBUTE_NAME))\r
+                            {\r
+                                _postconditionsStr.Add(customAttributes.Current.ConstructorArguments[0].Value + "." + customAttributes.Current.ConstructorArguments[1].Value);\r
+                            }\r
+                        }
+
+                        _tcInfoList.Add(new TestcaseInfo
+                        {
+                            TestcaseName = pair.Key,
+                            Preconditions = _preconditonsStr,
+                            Steps = _stepsStr,
+                            Postconditions = _postconditionsStr,
+                        });
+                        break;
                     }
                 }
-
-                _tcInfoList.Add(new TestcaseInfo
-                {
-                    TestcaseName = pair.Key,
-                    Preconditions = _preconditonsStr,
-                    Steps = _stepsStr,
-                    Postconditions = _postconditionsStr,
-                });
             }
         }
 
index b7c9b285a3e950dd32976ca8bb2d0e873c893d56..6aec04870dc0e50f99d1d94067a3d83f09c671cf 100755 (executable)
@@ -316,7 +316,36 @@ namespace NUnit.Framework.TUnit
                 return true;
             else
                 return false;
-        }
+        }\r
+\r
+        public List<string> ManualTestTaskRequest()\r
+        {\r
+            List<string> list = new List<string>();\r
+            string result = RequestGET("manual_cases", _session_id);\r
+            if (result == null)\r
+                return list;\r
+\r
+            result = result.Replace("[", "");\r
+            result = result.Replace("]", "");\r
+            result = result.Replace("\n", "");\r
+            result = result.Replace("{", "");\r
+            result = result.Replace("}", "");\r
+            result = result.Replace(" ", "");\r
+\r
+            string[] arr = result.Split(',');\r
+\r
+            foreach (string item in arr)\r
+            {\r
+                if (!item.Equals("") && item.Contains("case_id"))\r
+                {\r
+                    string tmp = item.Replace("\"", "");\r
+                    string[] keyValue = tmp.Split(':');\r
+                    list.Add(keyValue[1]);\r
+                }\r
+            }\r
+\r
+            return list;\r
+        }\r
 
         public string AutoTestTaskRequest()
         {
@@ -405,7 +434,7 @@ namespace NUnit.Framework.TUnit
                 StreamReader reader = new StreamReader(respPostStream);
                 result = reader.ReadToEnd();
 
-                Console.WriteLine("[TUnitTest] - " + "RequestPOST Result :" + result);
+                Console.WriteLine("[TUnitTest] - " + "###############Asavin############### RequestPOST Result :" + result);
                 reader.Dispose();
 
                 return result;
@@ -430,6 +459,18 @@ namespace NUnit.Framework.TUnit
         }
 
 #if TIZEN
+        public List<string> GetNotPassListManual()
+        {\r
+            List<string> list = new List<string>();
+            LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "############### GetNotPassListManual ###############");
+            if (AskNextStepRequest())
+            {
+                CheckExecutionProgressRequest();
+                list = ManualTestTaskRequest();
+            }
+            return list;
+        }
+
         public void NextStepRequest()
         {
             TLogger.Write("############### NextStepRequest ###############");