コード例 #1
0
        public static bool Finish()
        {
            // write RuntimeInstance.testingReportModel into RuntimeInstance.testReportFilePath file
            if (RuntimeInstance.currentTestingModule != null)
            {
                GUI_Utils.CheckRuntimeInstance();
                if (!RuntimeInstance.testingReportModel.ListTestModules.Contains(RuntimeInstance.currentTestingModule))
                {
                    RuntimeInstance.testingReportModel.ListTestModules.Add(RuntimeInstance.currentTestingModule);
                }
            }
            bool need2WriteLog = RuntimeInstance.testingReportModel != null &&
                                 RuntimeInstance.testingReportModel.ListTestModules != null &&
                                 RuntimeInstance.testingReportModel.ListTestModules.Count > 0;

            if (need2WriteLog)
            {
                TestReportFileLoader.WriteFile(RuntimeInstance.testReportFilePath, RuntimeInstance.testingReportModel);
            }
            if (need2WriteLog ||
                (RuntimeInstance.additionFiles != null &&
                 RuntimeInstance.additionFiles.Count > 0))
            {
                // add generated file to current testing project here
                AddReportFiles2Proj(need2WriteLog);
            }
            return(true);
        }
コード例 #2
0
        public static bool NotExists(IElement element)
        {
            AutomationElement autoElement = GUI_Utils.SearchAutomationElement(
                new IdAndNameDesignCondition(element.Attributes.DesignedId, element.Attributes.DesignedName));

            GUI_Utils.CheckRuntimeInstance();
            string message = "Check NotExist of " + element.Attributes.Name;
            string status  = ActionReport.STATUS_FAILTURE;
            string imgPath = null;
            bool   check   = (autoElement == null || autoElement.Current.IsOffscreen);

            if (check)
            {
                message += " successfully";
                status   = ActionReport.STATUS_SUCCESS;
            }
            else
            {
                message += " not successfully";
                status   = ActionReport.STATUS_FAILTURE;
                imgPath  = CaptureScreen();
            }
            GUI_Utils.AddNewActionReport(new ActionReport(
                                             message, status, ActionReport.CATEGORY_VALIDATION, imgPath));
            return(check);
        }
コード例 #3
0
        public static void InitNewModule(string moduleName)
        {
            string filePath = GetFilePath(moduleName, RuntimeInstance.listRunningFilesTest);

            if (filePath.EndsWith(".cs"))
            {
                filePath = filePath.Substring(0, filePath.Length - ".cs".Length);
            }
            RuntimeInstance.currentRunningFileTest = new Tuple <string, string>(moduleName, filePath);
            if (RuntimeInstance.currentTestingModule != null)
            {
                GUI_Utils.CheckRuntimeInstance();
                RuntimeInstance.testingReportModel.ListTestModules.Add(RuntimeInstance.currentTestingModule);
            }
            RuntimeInstance.currentTestingModule = null;
        }