Esempio n. 1
0
        public static Boolean driveFromExcel(string excelfilePath)
        {
            try
            {

                DataTable dtResultSummary = new DataTable();
                dtResultSummary.Columns.Add("SNO");
                dtResultSummary.Columns.Add("SCRIPTNAME");
                dtResultSummary.Columns.Add("COMMENT");
                dtResultSummary.Columns.Add("ACTION");
                dtResultSummary.Columns.Add("ARGUMENT");
                dtResultSummary.Columns.Add("RESULT");
                dtResultSummary.Columns.Add("TIMETAKEN");
                dtResultSummary.Columns.Add("MESSAGE");
                string keyWord = ""; string stpexecute = ""; string stepFrom = ""; string comment = "";
                string arg1 = ""; string arg2 = ""; string arg3 = ""; string arg4 = ""; string arg5 = "";
                Helper.TestDataManagement driverData = new Helper.TestDataManagement();
                string _epath = ConfigurationManager.AppSettings["logfile"];
                string apppath = ConfigurationManager.AppSettings["apppath"];
                string reportsSectionFile = ConfigurationManager.AppSettings["reportssectionfile"];
                string strfile = ConfigurationManager.AppSettings["driverfile"];


                Boolean returndriveFromExcel = true;
                Boolean _usewhite = Boolean.Parse(ConfigurationManager.AppSettings["usewhite"]);
                Boolean _detlog = Boolean.Parse(ConfigurationManager.AppSettings["Detaillog"]);

                //*************** 1. Launch Wellflo application ************************************

                //WPF_App.WpfAction wpfaction = new WPF_App.WpfAction();
                UIAutomation_App.UIAutomationAction uiautomation = new UIAutomation_App.UIAutomationAction();
                uiautomation._Attempts = _attempt;
                uiautomation.UseWhite = _usewhite;
                uiautomation._eLogPtah = _epath;
                uiautomation._reportsPath = _reportsPath;
                uiautomation._reportsSectionPath = reportsSectionFile;
                uiautomation.UseDetaillog = _detlog;
                Helper.TestDataManagement testdataobj = new Helper.TestDataManagement();
                Helper.LogManagement logg = new Helper.LogManagement();
                WellFloUI.MSUIAutomation wellflocomui = new WellFloUI.MSUIAutomation();
                uiautomation._testDataPath = _strPath;
                AutoItX3Lib.AutoItX3 autoit = new AutoItX3Lib.AutoItX3();
                Helper.ReportsManagement rpt = new Helper.ReportsManagement();

                driverData.GetTestData(excelfilePath, "Tmaster");

                int pascount = 0;
                int failcount = 0;

                for (int i = 0; i < driverData.Structure.Rows.Count; i++)
                {
                    System.Diagnostics.Stopwatch stopwatch3 = new System.Diagnostics.Stopwatch();
                    stopwatch3.Start();
                    DataRow dr = dtResultSummary.NewRow();
                    comment = driverData.Structure.Rows[i]["Comment"].ToString();
                    keyWord = driverData.Structure.Rows[i]["Keyword"].ToString();
                    stpexecute = driverData.Structure.Rows[i]["Execute"].ToString();
                    stepFrom = driverData.Structure.Rows[i]["StepFrom"].ToString();
                    arg1 = driverData.Structure.Rows[i]["arg1"].ToString();
                    arg2 = driverData.Structure.Rows[i]["arg2"].ToString();
                    arg3 = driverData.Structure.Rows[i]["arg3"].ToString();
                    arg4 = driverData.Structure.Rows[i]["arg4"].ToString();
                    arg5 = driverData.Structure.Rows[i]["arg5"].ToString();
                    dr["SCRIPTNAME"] = _scriptName;
                    dr["SNO"] = (sNo + 1).ToString();
                    dr["ACTION"] = keyWord;
                    if (comment == null)
                    {
                        dr["COMMENT"] = " ";
                    }
                    else
                    {
                        dr["COMMENT"] = comment;
                    }
                    if (arg1 == null)
                    {
                        dr["ARGUMENT"] = " ";
                    }
                    else
                    {
                        dr["ARGUMENT"] = arg1;
                    }

                    if (stpexecute.ToLower() == "y")
                    {
                        logg.CreateCustomLog(_epath, "Performing Keyword:=====>" + comment + "====================================");
                        switch (keyWord.ToLower())
                        {
                            #region Generic keywords
                            #region launchapplication
                            case "launchapplication":
                                {
                                    string repeat = new string('=', 50);
                                    logg.CreateCustomLog(_epath, repeat + " Launching Application " + arg1 + DateTime.Now.ToString() + repeat);
                                    try
                                    {

                                        if (stepFrom == "0")
                                        {

                                            if (GetOSArchitecture() == "32")
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 32 bit OS ");
                                                arg1 = arg1.Replace("Program Files (x86)", "Program Files");
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }
                                            else
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 64 bit OS ");
                                                if (arg1.Contains("x86") == false)
                                                {
                                                    arg1 = arg1.Replace("Program Files", "Program Files (x86)");
                                                }
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }

                                            //we are using realtive path wrt test folder for launch
                                            if (arg1.Contains("\\") == false)
                                            {
                                                arg1 = Path.Combine(ConfigurationManager.AppSettings["testinputdata"], arg1);
                                            }
                                            #region OriginalLaunch
                                            if (File.Exists(arg1) == false)
                                            {
                                                Console.WriteLine("The Argument passed from excel script -arg1" + arg1 + "Does not exist..Please verifty if paths and configurations are correct");
                                                return false;
                                            }
                                            System.Diagnostics.Process p = new System.Diagnostics.Process();
                                            p.StartInfo.FileName = arg1;
                                            Console.WriteLine("Argument is " + arg1);
                                            p.Start();
                                            int processId = p.Id;
                                            uiautomation._processId = processId;
                                            while (!p.MainWindowTitle.Contains(arg3))
                                            {
                                                Console.WriteLine("Window Title----> {0}", p.MainWindowTitle);
                                                Thread.Sleep(10);
                                                p.Refresh();

                                            }
                                            Console.WriteLine("End Window Title {0}", p.MainWindowTitle);
                                            #endregion OriginalLaunch



                                            int lastbackslashpos = arg1.LastIndexOf("\\") + 1;
                                            System.Console.WriteLine("lastbackslashpos: " + lastbackslashpos);
                                            int arg1Len = arg1.Length;
                                            System.Console.WriteLine("arg1 Length: " + arg1Len);
                                            int diff = arg1.Length - lastbackslashpos;
                                            System.Console.WriteLine("diff Length: " + diff);
                                            arg1 = arg1.Substring(lastbackslashpos, diff);
                                            if (arg1.Contains(".exe") == true)
                                            {
                                                arg1 = arg1.Replace(".exe", "");
                                            }

                                            System.Console.WriteLine("Exe or Process name to attach is: " + arg1);
                                            if (arg2 == null || arg2 == "") //use Process name from arg1 itself no need to supply from excel
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg1); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }
                                            else //read arg2 from Script File 
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }



                                        }
                                        else if (stepFrom == "1")
                                        {
                                            //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                            //uiautomation._application = app;
                                            //wpfaction._application = app;

                                        }
                                        else
                                        {
                                            logg.CreateCustomLog(_epath, "[Wraper]:Invalid stepfrom value");
                                        }
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        repeat = new string('=', 50);
                                        logg.CreateCustomLog(_epath, repeat + " Application Launched " + DateTime.Now.ToString() + repeat);
                                        pascount++;

                                    }

                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in Keyword Launch:" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated " + ex.Message;
                                        logg.CreateCustomLog(_epath, repeat + " Failed to Launch Application" + DateTime.Now.ToString() + repeat);
                                        failcount++;
                                    }


                                    break;
                                }
                            #endregion
                            #region launchindirect
                            case "launchindirect":
                                {
                                    try
                                    {

                                        if (stepFrom == "0")
                                        {

                                            if (GetOSArchitecture() == "32")
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 32 bit OS ");
                                                arg1 = arg1.Replace("Program Files (x86)", "Program Files");
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }
                                            else
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 64 bit OS ");
                                                if (arg1.Contains("x86") == false)
                                                {
                                                    arg1 = arg1.Replace("Program Files", "Program Files (x86)");
                                                }
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }



                                            #region New Launch
                                            System.Diagnostics.Process p = new System.Diagnostics.Process();
                                            p.StartInfo.FileName = arg1;

                                            p.Start();

                                            Process[] myprocess = Process.GetProcessesByName(arg2);

                                            while (myprocess.Length == 0)
                                            {
                                                logg.CreateCustomLog(_epath, "Launching Main Process ");
                                                myprocess = Process.GetProcessesByName(arg2);
                                                Thread.Sleep(1000);

                                            }
                                            logg.CreateCustomLog(_epath, "Launched: " + myprocess[0].ProcessName);
                                            Process actualProcess = myprocess[0];

                                            while (!actualProcess.MainWindowTitle.Contains(arg3))
                                            {
                                                Console.WriteLine("Window Title----> {0}", actualProcess.MainWindowTitle);
                                                Thread.Sleep(10);
                                                actualProcess.Refresh();

                                            }
                                            Console.WriteLine("End Window Title {0}", actualProcess.MainWindowTitle);
                                            uiautomation._processId = actualProcess.Id;
                                            #endregion



                                            int lastbackslashpos = arg1.LastIndexOf("\\") + 1;
                                            System.Console.WriteLine("lastbackslashpos: " + lastbackslashpos);
                                            int arg1Len = arg1.Length;
                                            System.Console.WriteLine("arg1 Length: " + arg1Len);
                                            int diff = arg1.Length - lastbackslashpos;
                                            System.Console.WriteLine("diff Length: " + diff);
                                            arg1 = arg1.Substring(lastbackslashpos, diff);
                                            if (arg1.Contains(".exe") == true)
                                            {
                                                arg1 = arg1.Replace(".exe", "");
                                            }

                                            System.Console.WriteLine("Exe or Process name to attach is: " + arg1);
                                            if (arg2 == null || arg2 == "") //use Process name from arg1 itself no need to supply from excel
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg1); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }
                                            else //read arg2 from Script File 
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }



                                        }
                                        else if (stepFrom == "1")
                                        {
                                            //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                            //uiautomation._application = app;
                                            //uiautomation._processId = app.Process.Id;
                                            //wpfaction._application = app;

                                        }
                                        else
                                        {
                                            logg.CreateCustomLog(_epath, "[Wraper]:Invalid stepfrom value");
                                        }
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }

                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in Keyword Launchindirect:" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated " + ex.Message;
                                    }
                                    break;
                                }
                            #endregion
                            #region closewindow
                            case "closewindow":
                                {
                                    try
                                    {
                                        Thread.Sleep(2000);
                                        SendKeys.SendWait("{ENTER}");
                                        SendKeys.SendWait("{ENTER}");
                                        SendKeys.SendWait("%{F4}");
                                        SendKeys.SendWait("{ENTER}");
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function CloseWindow" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region inputformdata
                            case "inputformdata":
                                {
                                    string repeat = new string('=', 50);
                                    logg.CreateCustomLog(_epath, "Strpath value is :" + _strPath);
                                    logg.CreateCustomLog(_epath, repeat + " Adding Data from Excel Path:=" + _strPath + arg1 + " for test case " + arg2 + DateTime.Now.ToString() + repeat);
                                    try
                                    {
                                        uiautomation.AddData(_strPath + arg1, arg2);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        failcount++;
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function inputformdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();


                                    }
                                    break;
                                }
                            #endregion
                            #region comapredoc
                            case "comparedoc":
                                {
                                    try
                                    {
                                        TestDataManagement testData = new Helper.TestDataManagement();

                                        testData.GetTestData(_strPath + arg1, "T1");
                                        DataTable expectedData = testData.Data;
                                        int tableNumber = int.Parse(arg3);
                                        //DataTable actualData = verifyReport(_strPath + arg2, tableNumber);
                                        //DataTable ResultTable = CompareData(expectedData, actualData);
                                        //Helper.ReportsManagement rppt1 = new Helper.ReportsManagement();
                                        //rppt1.ResultTable = ResultTable;
                                        //rppt1.ReportPath = arg5;
                                        //rppt1.GenerateReport(_strPath + arg4);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function inputformdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region verifyfileexistence
                            case "verifyfileexistence":
                                {
                                    try
                                    {
                                        string expectedData = _strPath + arg1;
                                        DataTable ResultTable = verifyFileExistence(expectedData);
                                        Helper.ReportsManagement rppt1 = new Helper.ReportsManagement();
                                        rppt1.ResultTable = ResultTable;
                                        rppt1.ReportPath = arg5;
                                        rppt1.GenerateReport(_strPath + arg4);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function inputformdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region closewindowwithtitle
                            case "closewindowwithtitle":
                                {
                                    try
                                    {
                                        //uiautomation._globalWindow = wpfaction.GetWPFWindow(arg1);
                                        uiautomation.closeGlobalWindow();
                                        Thread.Sleep(2000);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in closewindowwithtitle" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region resetuiwindow
                            case "resetuiwindow":
                                {
                                    try
                                    {
                                        uiautomation.uiAutomationWindow = null;
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in resetuiwindow" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifydatatable
                            case "verifydatatable":
                                {
                                    try
                                    {
                                        uiautomation.VerifyData(_strPath + arg1, arg2);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifydatatable" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;


                                }
                            #endregion
                            #region verifyformdata
                            case "verifyformdata":
                                {
                                    try
                                    {
                                        _finalReports = arg5;
                                        string repeat = new string('=', 50);
                                        logg.CreateCustomLog(_epath, arg1);
                                        logg.CreateCustomLog(_epath, arg2);
                                        logg.CreateCustomLog(_epath, arg3);
                                        logg.CreateCustomLog(_epath, arg4);
                                        logg.CreateCustomLog(_epath, arg5);
                                        logg.CreateCustomLog(_epath, "1-5 arguments");
                                        logg.CreateCustomLog(_epath, repeat + "Verifying Data from Excel " + arg1 + "for test case " + arg2 + DateTime.Now.ToString() + repeat);
                                        uiautomation.verifyDataForm(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifydatatable" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region compareXML
                            case "comparexml":
                                {
                                    try
                                    {
                                        _finalReports = arg4;
                                        arg3 = ConfigurationManager.AppSettings["testinputdata"] + arg3;  //arr[0];
                                        logg.CreateCustomLog(_epath, "Path used for comparexml keyword" + arg1);

                                        if (arg1.Trim().Length == 0 || arg2.Trim().Length == 0 || arg3.Trim().Length == 0 || arg4.Trim().Length == 0)
                                            logg.CreateCustomLog(_epath, "Need values for arg1,arg2,arg3 and arg4");
                                        else
                                        {

                                            CompareXML(arg1, arg2, arg3, arg4, logg, _epath);
                                            stopwatch3.Stop();
                                            dr["RESULT"] = "Success";
                                            dr["MESSAGE"] = "Completed";
                                            dr["TimeTaken"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  comparexml " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifydataiepanetable
                            case "verifydataiepanetable":
                                {
                                    try
                                    {
                                        uiautomation.verifyDataIEPaneTable(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "verifydataiepanetable" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region manualintervention
                            case "manualintervention":
                                {
                                    try
                                    {
                                        fn_BalloonToolTip(arg1, arg2);
                                        Console.WriteLine("Please Press Enter to proceed to next step");
                                        Console.ReadLine();
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in manualintervention" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifywpfdatagrid
                            case "verifywpfdatagrid":
                                {
                                    try
                                    {
                                        uiautomation.VerifyDataGridContent(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifywpfdatagrid" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifydatagrid

                            case "verifydatagrid":
                                {
                                    try
                                    {
                                        uiautomation.VerifyDataGrid2Content(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifydatagrid" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;

                                }
                            #endregion
                            #region verify_plotdata
                            case "verify_plotdata":
                                {
                                    try
                                    {
                                        verify_plotdata(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verify_plotdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region infraselectrows

                            case "infraselectrows":
                                {
                                    try
                                    {
                                        selectspecfedrows(Int32.Parse(arg1), Int32.Parse(arg2));
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in infraselectrows" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;

                                }
                            #endregion
                            #region clickbuttonwindowtitle
                            case "clickbuttonwindowtitle":
                                {
                                    try
                                    {
                                        wellflocomui.GetAppWindow(arg1);
                                        wellflocomui.ClickButton(arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in clickbuttonwindowtitle" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region clickbuttonwindowautoid
                            case "clickbuttonwindowautoid":
                                {
                                    try
                                    {
                                        //SearchCriteria search = SearchCriteria.ByAutomationId(arg1);
                                        //Window wnd = wpfaction._application.GetWindow(search, White.Core.Factory.InitializeOption.NoCache);
                                        //var btn = wnd.Get<White.Core.UIItems.Button>(arg2);
                                        //btn.Click();
                                        //dr["RESULT"] = "Success";
                                        //dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        //pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in clickbuttonwindowautoid" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region clickbuttonchildwindowtitle
                            case "clickbuttonchildwindowtitle":
                                {
                                    try
                                    {
                                        specialApply(arg1, arg2, arg3);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in clickbuttonchildwindowtitle" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region clickcordinates
                            case "clickcordinates":
                                {
                                    try
                                    {
                                        string repeat = new string('=', 50);
                                        logg.CreateCustomLog(_epath, repeat + " Clicking coordinates " + arg1 + ";" + arg2 + DateTime.Now.ToString() + repeat);
                                        AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                        int x1 = Convert.ToInt32(arg1);
                                        int y1 = Convert.ToInt32(arg2);
                                        at1.MouseClick("LEFT", x1, y1, 1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickcordinates" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region createoutputimage
                            case "createoutputimage":
                                {
                                    try
                                    {
                                        createOutputImage(arg1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  createoutputimage" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region clickcordinatesdbl
                            case "clickcordinatesdbl":
                                {
                                    try
                                    {
                                        AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                        int x1 = Convert.ToInt32(arg1);
                                        int y1 = Convert.ToInt32(arg2);
                                        at1.MouseClick("LEFT", x1, y1, 2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickcordinates" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region rightclick
                            case "rightclick":
                                {
                                    try
                                    {
                                        AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                        int x1 = Convert.ToInt32(arg1);
                                        int y1 = Convert.ToInt32(arg2);
                                        at1.MouseClick("RIGHT", x1, y1, 1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  rightclick" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region wait
                            case "wait":
                                {
                                    try
                                    {
                                        logg.CreateCustomLog(_epath, "Performing Keyword:===== Wait ====================================");
                                        Console.WriteLine("Waiting in Driver script for " + arg1 + "seconds");
                                        Thread.Sleep(Int32.Parse(arg1) * 1000);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  wait" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region updatestructure
                            case "updatestructure":
                                {
                                    try
                                    {
                                        UpdateStructure(arg1, arg2, arg3, arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  updatestructure" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region setexpectednactualdata
                            case "setexpectednactualdata":
                                {
                                    try
                                    {
                                        testdataobj.ActualData.Clear();
                                        testdataobj.ExpectedData.Clear();
                                        testdataobj.GetTestData(arg1, arg2);
                                        testdataobj.ActualData = testdataobj.Data;
                                        testdataobj.ExpectedData = testdataobj.GetVerificationData(arg3, arg4);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  setexpectednactualdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region comparecsv
                            case "comparecsv":
                                {
                                    try
                                    {
                                        testdataobj.CompareData();
                                        logg.CreateCustomLog(_epath, "Compare Data Finished");
                                        rpt.ResultTable = testdataobj.ResultTable;
                                        rpt.ReportPath = arg2;
                                        logg.CreateCustomLog(_epath, "Trying to create Report");
                                        rpt.GenerateReport(_strPath + arg1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  comparecsv" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }


                                    break;
                                }
                            #endregion
                            #region upadtereportersheet
                            case "upadtereportersheet":
                                {
                                    try
                                    {
                                        testdataobj.UpdateReporterSheet(_strPath + arg1, "testcase", arg2);
                                        testdataobj.UpdateReporterSheet(_strPath + arg1, "section", arg3);
                                        testdataobj.UpdateReporterSheet(_strPath + arg1, "webtable", arg4);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  upadtereportersheet" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region copydata
                            case "copydata":
                                {
                                    try
                                    {
                                        Excel.Application xlApp = new Excel.Application();
                                        Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(_strPath + arg1);
                                        Excel._Worksheet xlWorksheet = (Excel._Worksheet)xlWorkbook.Sheets[1];
                                        Excel.Range xlRange = xlWorksheet.UsedRange;
                                        xlRange.Copy(System.Type.Missing);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  CopyData" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifywordfile
                            case "verifywordfile":
                                {
                                    try
                                    {
                                        worddocverification(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  verifywordfile " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;

                                }

                            #endregion
                            #region writeingrid
                            case "writeingrid":
                                {
                                    try
                                    {
                                        writeGridContent(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  writeingrid " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region Compare Excel
                            case "compareexcel":
                                {
                                    try
                                    {
                                        CompareExcel(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  writeingrid " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }

                            #endregion

                            #region Lowis related keywords
                            #region deletefile
                            case "deletefile":
                                {
                                    try
                                    {


                                        DeleteFile(arg1, logg, _epath);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  DeleteFile " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region deletefiles
                            case "deletefiles":
                                {
                                    try
                                    {
                                        testdataobj.GetTestData(_deleteFilesPath, "");

                                        DataTable dtDelete = testdataobj.Data;
                                        for (int row = 0; i < dtDelete.Rows.Count; row++)
                                        {
                                            DeleteFile((string)dtDelete.Rows[row][0], logg, _epath);
                                        }
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  DeleteFiles " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region searchgridrow
                            case "searchgridrow":
                                {
                                    try
                                    {
                                        SearchGridRow(arg1, arg2, arg3, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {


                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  searchgridrow " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region addrowtodatagrid
                            case "addrowtodatagrid":
                                {
                                    try
                                    {
                                        AddRowToDataGrid(arg1, arg2, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {


                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  addrowtodatagrid " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region clickmenus
                            case "clickmenus":
                                {
                                    try
                                    {
                                        ClickMenus(arg1, arg2, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed";
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {


                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickmenus " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region clickmenus
                            case "clickbeamdesign":
                                {
                                    try
                                    {
                                        ClickBeamDesign(arg1, arg2, arg3, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed";
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();


                                    }
                                    catch (Exception ex)
                                    {

                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickbeamdesign " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region cleanupcstore
                            case "cleanupcstore":
                                {
                                    try
                                    {
                                        cleanupcstore(arg1);

                                        dr["RESULT"] = "Success";
                                        dr["Message"] = "Completed";
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  cleanupcstore " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    break;
                                }

                            #endregion
                            #region menuiteam
                            case "menuiteam":
                                {
                                    try
                                    {
                                        menuiteam(arg1);

                                        dr["RESULT"] = "Sucess";
                                        dr["Message"] = "Completed";
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in menuiteam" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region standardpump
                            case "standardpump":
                                {
                                    try
                                    {
                                        standardpump(arg1, arg2, arg3);

                                        dr["RESULT"] = "Sucess";
                                        dr["Message"] = "Completed";
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in standardpumpsave" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #endregion

                            default:
                                returndriveFromExcel = false;
                                throw new Exception("Not a valid Keyword");
                        }
                        dtResultSummary.Rows.Add(dr);
                        sNo = sNo + 1;
                    }
                    else
                    {
                        // logg.CreateCustomLog(_epath, "[Wraper]:Not Executing the Keyword: -> " + keyWord);
                    }

                    if (returndriveFromExcel == false)
                    {
                        logg.CreateCustomLog(_epath, "*********************ScriptTermination ********************************");
                        logg.CreateCustomLog(_epath, "Script: " + excelfilePath + "was terminited due to above errors and host or application was also terminated");
                        break;
                    }

                }
                GenerateReport(_resultsSummaryFile, dtResultSummary);

                if (File.Exists(_resultsFile) == false)
                {
                    Console.WriteLine("Result File does not exist:  " + _resultsFile);
                }
                else
                {
                    DataTable dtResults = GetResultsData(_resultsFile, "");
                    DataRow[] success = dtResults.Select("Result= 'Pass'");
                    DataRow[] failed = dtResults.Select("Result='Fail'");


                    Console.WriteLine("Finished Test (Errors:" + failed.Length.ToString() + "," + " Warnings:" + failcount + ")");
                }
                return returndriveFromExcel;
            }
            catch (Exception ex)

            {
                Console.WriteLine("Generic Error has occurred " + ex.Message);
                return false;
            }

        }
Esempio n. 2
0
        private static void AddRowToDataGrid(string verificationFile, string testCase, int processID)
        {

            try
            {

                Console.WriteLine("Key word AddRowToDataGrid");
                UIAutomation_App.UIAutomationAction uAutomation = new UIAutomation_App.UIAutomationAction();

                Helper.TestDataManagement helper = new TestDataManagement();

                DataTable template = helper.GetVerificationData(verificationFile, testCase);
                DataTable data = helper.ExpectedData;

                if (template.Rows.Count <= 0)
                    throw new Exception("No data found in template sheet");
                if (data.Rows.Count <= 0)
                    throw new Exception("No data found in data sheet");

                Console.WriteLine("Read data from Template and Data Sheet");
                string parentSearchBy = (string)template.Rows[0]["ParentSearchBy"].ToString();
                string parentSearchValue = (string)template.Rows[0]["ParentSearchValue"].ToString();

                string gridSearchBy = (string)template.Rows[0]["gridsearchby"].ToString();
                string gridSearchValue = (string)template.Rows[0]["gridsearchvalue"].ToString();

                int targetRow = 0;


                uAutomation._processId = processID;


                AutomationElement winElement = GetCustomWindowByName(parentSearchValue, processID);
                uAutomation.uiAutomationCurrentParent = winElement;


                Console.WriteLine("Read window : " + winElement.Current.Name);
                AutomationElementCollection gridCollection = winElement.FindAll(TreeScope.Descendants,
                                                                                     new System.Windows.Automation.PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.DataGrid));

                #region Searching Grid in Collection
                AutomationElement grid = null;
                for (int i = 0; i < gridCollection.Count; i++)
                {
                    if (gridCollection[i].Current.Name.ToLower() == gridSearchValue.ToLower() || gridCollection[i].Current.AutomationId.ToLower() == gridSearchValue.ToLower())
                    {
                        grid = gridCollection[i];
                        break;
                    }

                }
                #endregion


                Console.WriteLine("Read Grid : " + grid.Current.Name);

                AutomationElementCollection gridRows = grid.FindAll(TreeScope.Children,
                                     new System.Windows.Automation.PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.DataItem));

                Console.WriteLine("Read Grid rows : " + gridRows.Count);

                #region Loop from Template Sheet and for each row in Template seek data for test cases from data sheet
                for (int templateRow = 0; templateRow < template.Rows.Count; templateRow++)
                {
                    int columnNo = int.Parse(template.Rows[templateRow]["columnno"].ToString());
                    string fieldName = (string)template.Rows[templateRow]["FieldName"].ToString();
                    for (int dataRow = 0; dataRow < data.Rows.Count; dataRow++)
                    {

                        targetRow = int.Parse(data.Rows[dataRow]["RowNo"].ToString());
                        AutomationElementCollection customControls = gridRows[targetRow].FindAll(TreeScope.Children,
                   new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Custom));

                        string datavalue = (string)data.Rows[dataRow][fieldName].ToString();
                        Console.WriteLine("Current Control :" + (string)template.Rows[templateRow]["controltype"].ToString());

                        switch ((string)template.Rows[templateRow]["ControlType"].ToString())
                        {
                            case "ucombobox":
                                AutomationElement comboBox = customControls[columnNo].FindFirst(TreeScope.Descendants,
                                         new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.ComboBox));
                                comboBox.SetFocus();
                                ValuePattern value = (ValuePattern)comboBox.GetCurrentPattern(ValuePattern.Pattern);
                                value.SetValue(datavalue);
                                break;
                            case "uedit":
                                AutomationElement edit = customControls[columnNo].FindFirst(TreeScope.Descendants,
                                     new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit));
                                edit.SetFocus();

                                ValuePattern valPat = (ValuePattern)edit.GetCurrentPattern(ValuePattern.Pattern);
                                valPat.SetValue(datavalue);
                                break;
                            default:
                                break;
                        }


                    }
                }
                #endregion


            }
            catch (Exception ex)
            {

                throw new Exception(ex.Message);
            }



        }
Esempio n. 3
0
 private static void CompareXML(string expectedXmlFilePath, string actualXmlPath, string reportTemplate, string reportPath, LogManagement logg, string logpath)
 {
     try
     {
         logg.CreateCustomLog(logpath, "Inside CompareXML");
         TestDataManagement management = new TestDataManagement();
         ReportsManagement management2 = new ReportsManagement();
         management.ActualData.Clear();
         management.ExpectedData.Clear();
         logg.CreateCustomLog(logpath, "Cleared old data");
         DataSet set = new DataSet();
         
         DataSet set2 = new DataSet();
         set.ReadXml(expectedXmlFilePath);
         logg.CreateCustomLog(logpath, "Loaded ExpectedXML");
         set2.ReadXml(actualXmlPath);
         logg.CreateCustomLog(logpath, "Loaded actualXML");
         management.ExpectedData = set.Tables[0];
         management.ActualData = set2.Tables[0];
         logg.CreateCustomLog(logpath, "Created Actual and Expected Data Sets");
         management.CompareData();
         logg.CreateCustomLog(logpath, "DataBinder Compared");
         management2.ResultTable = management.ResultTable;
         Console.WriteLine(management.ResultTable.Rows.Count);
         management2.ReportPath = reportPath;
         management2.GenerateReport(reportTemplate);
         logg.CreateCustomLog(logpath, "Report Generated");
     }
     catch (Exception exception)
     {
         throw new Exception("Error in function CompareXML" + exception.Message);
     }
 }
Esempio n. 4
0
        static void writeGridContent(string testDataFile, string testcase)
        {
            string TableType = "";
            string SearchBy = "";
            string SearchValue = "";
            int tindex = -1;
            var _logicalName = "";//coulmnname/fieldname  alias 
            Helper.TestDataManagement testData = new Helper.TestDataManagement();
            UIAutomation_App.UIAutomationAction uiautomation1 = new UIAutomation_App.UIAutomationAction();

            string _epath = ConfigurationManager.AppSettings["logfile"];
            uiautomation1._eLogPtah = _epath;


            try
            {

                testData.GetVerificationData(testDataFile, testcase);
                TableType = testData.Template.Rows[0]["TableType"].ToString();
                SearchBy = testData.Template.Rows[0]["SearchBy"].ToString().ToLower();
                SearchValue = testData.Template.Rows[0]["SearchValue"].ToString();
                if (SearchBy.ToLower() == "index")
                {
                    tindex = Int32.Parse(SearchValue);
                }

                uiautomation1.uiAutomationWindow = uiautomation1.GetUIAutomationWindow("title", "K2");

                uiautomation1.uiAutomationCurrentParent = uiautomation1.uiAutomationWindow;

                AutomationElement datagridtable = uiautomation1.GetUIAutomationDataGrid(SearchBy, SearchValue, tindex);
                if (datagridtable != null)
                {
                    uiautomation1.logTofile(uiautomation1._eLogPtah, "[writeGridContent]:Datagrid Object has been detected!");
                }
                AutomationElementCollection datarows = datagridtable.FindAll(TreeScope.Children,
                        new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.DataItem));
                uiautomation1.logTofile(uiautomation1._eLogPtah, "[writeGridContent]: DataGrid Rows count is =" + datarows.Count.ToString());
                for (int ip = 0; ip < datarows.Count; ip++)
                {
                    AutomationElementCollection cells = datarows[ip].FindAll(TreeScope.Children,
                    new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Custom));
                    uiautomation1.logTofile(uiautomation1._eLogPtah, "[writeGridContent]: Cells or columns count " + cells.Count);
                    try
                    {
                        AutomationElement elementNode = TreeWalker.ControlViewWalker.GetFirstChild(cells[0]);
                        uiautomation1.logTofile(uiautomation1._eLogPtah, "after element node");
                        ValuePattern valpat = (ValuePattern)elementNode.GetCurrentPattern(ValuePattern.Pattern);
                        _logicalName = (string)testData.Template.Rows[0]["FieldName"];
                        var valueofcell = valpat.Current.Value;
                        valpat.SetValue((string)testData.ExpectedData.Rows[ip][_logicalName]);
                    }
                    catch
                    {
                    }
                    for (int i = 0; i < cells.Count; i++)
                    {
                        uiautomation1.logTofile(uiautomation1._eLogPtah, "[writeGridContent]: Trying Value patern " + i);
                        uiautomation1.logTofile(uiautomation1._eLogPtah, "before element node");
                        AutomationElement elementNode = TreeWalker.ControlViewWalker.GetFirstChild(cells[i]);
                        uiautomation1.logTofile(uiautomation1._eLogPtah, "after element node");
                        ValuePattern valpat = (ValuePattern)elementNode.GetCurrentPattern(ValuePattern.Pattern);
                        _logicalName = (string)testData.Template.Rows[i]["FieldName"];
                        var valueofcell = valpat.Current.Value;
                        valpat.SetValue((string)testData.ExpectedData.Rows[ip][_logicalName]);
                    }

                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("[writeGridContent]:Execption Message : " + ex.Message.ToString());
            }
        }
Esempio n. 5
0
        static void verify_plotdata(string expectedFile, string testcaseid)
        {

            Helper.TestDataManagement testlocal = new Helper.TestDataManagement();
            testlocal.GetTestData(expectedFile, testcaseid);
            string _logicalName = (string)testlocal.Structure.Rows[0]["FieldName"].ToString();
            string _controlValue = (string)testlocal.Data.Rows[0][_logicalName].ToString();
            char[] celldellim = new char[] { ';' };
            string[] arr = _controlValue.Split(celldellim);
            string _testDataPath = ConfigurationManager.AppSettings["testinputdata"];  //arr[0];
            string paramfiletcase = arr[1];
            string expectedfileName = arr[2];
            string tcase = arr[3];
            string otptfile = arr[4];

            testlocal.UpdateTestData(_testDataPath + @"paramFile.xls", paramfiletcase, "expectedFile", _testDataPath + expectedfileName);
            testlocal.UpdateTestData(_testDataPath + @"paramFile.xls", paramfiletcase, "testcaseID", tcase);
            testlocal.UpdateTestData(_testDataPath + @"paramFile.xls", paramfiletcase, "tempFilePath", @"C:\created.txt");
            testlocal.UpdateTestData(_testDataPath + @"paramFile.xls", paramfiletcase, "resultspath", otptfile);

            //put information of testdata dynamicaly in a vbs file to read 

            RunVBS(_testDataPath + @"\Verifyplotdata.vbs");
            System.IO.File.Delete(@"C:\created.txt");
        }
Esempio n. 6
0
        public static DataTable GetResultsData(string testDataFile, string testCase)
        {


            Helper.TestDataManagement testData = new Helper.TestDataManagement();
            Console.WriteLine("Trying to get testat from" + testDataFile);
            testData.GetTestData(testDataFile, "");
            DataTable dt = testData.Data;
            //Console.WriteLine(dt.Rows.Count.ToString());
            return dt;
        }