public int _xls_ReturnDataRow2Test(string sTestData) { MyExcel _xlsTD = new MyExcel(sTestData, false); if (!_xlsTD.OpenExcelFile(1)) { _gLib._Report(_PassFailStep.Fail, "Fail to open excel file: " + sTestData); _xlsTD.CloseExcelApplication(); _gLib._MsgBoxYesNo("Continue Testing?", "Fail to open excel file: " + sTestData); return(0); } int iTotalRow = _xlsTD.getTotalRowCount(); string sStatus = ""; int iRow_Ready = 0; for (int i = 2; i <= iTotalRow; i++) { sStatus = _xlsTD.getOneCellValue(i, 1); if (sStatus.ToLower() == "ready") { iRow_Ready = i; break; } } _xlsTD.CloseExcelApplication(); return(iRow_Ready); }
public int _xls_GetClientPlan(string sTestData, int iRow) { MyExcel _xlsTD = new MyExcel(sTestData, false); if (!_xlsTD.OpenExcelFile(1)) { _gLib._Report(_PassFailStep.Fail, "Fail to open excel file: " + sTestData); _gLib._MsgBoxYesNo("Continue Testing?", "Fail to open excel file: " + sTestData); return(0); } sClient = _xlsTD.getOneCellValue(iRow, iCol_Client); sPlan = _xlsTD.getOneCellValue(iRow, iCol_Plan); _xlsTD.CloseExcelApplication(); if (sClient == "" || sPlan == "") { return(0); } else { return(1); } }
public string _xls_ReturnGivenName(int iRow, string sTestData) { string sName = ""; MyExcel _xlsTD = new MyExcel(sTestData, false); if (!_xlsTD.OpenExcelFile(1)) { _gLib._Report(_PassFailStep.Fail, "Fail to open excel file: " + sTestData); _xlsTD.CloseExcelApplication(); _gLib._MsgBoxYesNo("Continue Testing?", "Fail to open excel file: " + sTestData); return(""); } sName = _xlsTD.getOneCellValue(iRow, 14); _xlsTD.CloseExcelApplication(); return(sName); }
public string _xls_ReturnOutputDir(string sTestData) { string sDir = ""; MyExcel _xlsTD = new MyExcel(sTestData, false); if (!_xlsTD.OpenExcelFile(1)) { _gLib._Report(_PassFailStep.Fail, "Fail to open excel file: " + sTestData); _xlsTD.CloseExcelApplication(); _gLib._MsgBoxYesNo("Continue Testing?", "Fail to open excel file: " + sTestData); return(""); } sDir = _xlsTD.getOneCellValue(2, 13); _xlsTD.CloseExcelApplication(); return(sDir); }
public int _xls_ReturnServiceMaxCheckNum(string sTestData) { int iMax = 30; MyExcel _xlsTD = new MyExcel(sTestData, false); if (!_xlsTD.OpenExcelFile(1)) { _gLib._Report(_PassFailStep.Fail, "Fail to open excel file: " + sTestData); _xlsTD.CloseExcelApplication(); _gLib._MsgBoxYesNo("Continue Testing?", "Fail to open excel file: " + sTestData); return(0); } string sNum = _xlsTD.getOneCellValue(2, 12); iMax = Convert.ToInt32(sNum); _xlsTD.CloseExcelApplication(); return(iMax); }
public int _xls_ReturnTotalRow(string sTestData) { MyExcel _xlsTD = new MyExcel(sTestData, false); if (!_xlsTD.OpenExcelFile(1)) { _gLib._Report(_PassFailStep.Fail, "Fail to open excel file: " + sTestData); _gLib._MsgBoxYesNo("Continue Testing?", "Fail to open excel file: " + sTestData); return(0); } int totalRow = _xlsTD.getTotalRowCount(); _xlsTD.CloseExcelApplication(); return(totalRow); }
private void loadTestData_Click(object sender, EventArgs e) { var fileContent = string.Empty; var filePath = string.Empty; using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.InitialDirectory = @"C:\Users\webber-ling\Desktop\_RTS\RetirementStudio"; openFileDialog.Filter = "All files (*.*)|*.*|xls files (*.xls)|*.xls|xlsx files (*.xlsx)|*.xlsx"; openFileDialog.FilterIndex = 1; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { filePath = openFileDialog.FileName; //////////Read the contents of the file into a stream ////////var fileStream = openFileDialog.OpenFile(); ////////using (StreamReader reader = new StreamReader(fileStream)) ////////{ //////// fileContent = reader.ReadToEnd(); ////////} MyExcel _testData = new MyExcel(filePath, false); if (!_testData.OpenExcelFile("Sheet1")) { MessageBox.Show("Fail to open excel: " + filePath, "Warning", MessageBoxButtons.OK); return; } int iTotalRow = _testData.getTotalRowCount(); listBox1.Items.Add("#NumOfEE - ClientShortName - RunType"); for (int i = 2; i <= iTotalRow; i++) { string sRun = _testData.getOneCellValue(i, 1); string sTotalEE = _testData.getOneCellValue(i, 2); string sRunType = _testData.getOneCellValue(i, 3); string sClientShortName = _testData.getOneCellValue(i, 4); string info = sTotalEE + " - " + sClientShortName + " - " + sRunType; //////MessageBox.Show(info, "Warning", MessageBoxButtons.OK); if (sRun.ToUpper().Equals("YES")) { listBox1.Items.Add(info); } } listBox1.Items.Add("------------------------- Loading Testing Data Compelete -------------------------"); listBox1.Items.Add("------------------------- Click Run Test Button to Start Test-------------------------"); _testData.CloseExcelApplication(); } } //////MessageBox.Show("File Content at path: " + filePath, "Warning", MessageBoxButtons.OK); }
public void test_US_Time_Cloud_Custom() { //pMain._SetLanguageAndRegional(); /// has to be under United States List <Node> nodelist = new List <Node>(); //nodelist.Add(new Node("QA US Benchmark 015 Existing DNT", "QA US Benchmark 015 Existing DNT Plan", "FundingValuations", "Valuation 2011", "Baseline", "", "", "2", "1", "Group Job Successfully Complete", 20, 53, "")); //nodelist.Add(new Node("QA US Benchmark 015 Existing DNT", "QA US Benchmark 015 Existing DNT Plan", "FundingValuations", "Valuation 2011", "Baseline", "", "2", "3", "1", "Group Job Successfully Complete", 20, 145, "FV Proj")); //nodelist.Add(new Node("QA US Benchmark 015 Existing DNT", "QA US Benchmark 015 Existing DNT Plan", "FundingValuations", "Valuation 2011", "Baseline", "", "2", "3", "2", "Group Job Successfully Complete", 20, 152, "FV Liab")); //nodelist.Add(new Node("QA US Benchmark 008 Existing DNT", "QA US Benchmark 008 Existing DNT Plan", "FundingValuations", "Conversion 2011", "Baseline", "", "", "1", "1", "Group Job Successfully Complete", 125, 18, "")); //nodelist.Add(new Node("QA US Benchmark 010 Existing DNT", "QA US Benchmark 010 Existing DNT Plan", "FundingValuations", "July 2006 Valuation", "Baseline", "", "", "1", "1", "Group Job Successfully Complete", 590, 32, "")); //nodelist.Add(new Node("QA US Benchmark 007 Existing DNT", "QA US Benchmark 007 Existing DNT Plan", "FundingValuations", "Funding 2005", "Baseline", "", "", "1", "1", "Group Job Successfully Complete with 2 NP", 1236, 4, "")); //nodelist.Add(new Node("QA US Benchmark 009 Existing DNT", "QA US Benchmark 009 Plan Existing DNT", "FundingValuations", "2005 Funding", "Baseline", "", "", "1", "1", "Group Job Successfully Complete", 9554, 25, "")); //nodelist.Add(new Node("QA US Benchmark 019 Existing DNT", "QA US Benchmark 019 Existing DNT Plan", "FundingValuations", "1.1.2017 Funding Valuation", "Baseline", "", "0", "1", "1", "Group Job Successfully Complete", 784, 159, "FV Proj")); //nodelist.Add(new Node("QA US Benchmark 019 Existing DNT", "QA US Benchmark 019 Existing DNT Plan", "FundingValuations", "1.1.2018 Funding Valuation", "Future Val Run", "", "0", "3", "1", "Group Job Successfully Complete", 784, 166, "FV Liab")); nodelist.Add(new Node("QA US Benchmark 009 Existing DNT_50000", "QA US Benchmark 009 Plan Existing DNT", "FundingValuations", "2005 Funding", "Baseline", "", "", "1", "1", "Group Job Successfully Complete", 50000, 25, "")); #region for Dev use only //////string sLogFile = CodeBase(TestContext).Replace("RetirementStudio.DLL", "000_Dev_US_Timing_Test_Cloud_Custom.xls"); //////MyTimer mTime = new MyTimer(sCol_Time, sLogFile); //////MyLog mLog = new MyLog(sCol_Memory, sLogFile); //////MyLog mLogTime = new MyLog(sCol_Time, sLogFile); //////MyExcel _testData = new MyExcel(CodeBase(TestContext).Replace("RetirementStudio.DLL", "000_Dev_TestData_Cloud.xls"), false); ////////////_gLib._MsgBoxYesNo("Total Num of Clients to Run", CodeBase(TestContext).Replace("RetirementStudio.DLL", "000_Dev_TestData_Cloud.xls")); //////if (!_testData.OpenExcelFile("Sheet1")) //////{ ////// _gLib._MsgBoxYesNo("Warning", "Fail to open excel: " + CodeBase(TestContext).Replace("RetirementStudio.dll", "000_Dev_TestData_Cloud.xls")); //////} //////int iTotalRow = _testData.getTotalRowCount(); //////for (int i = 2; i <= iTotalRow; i++) //////{ ////// string sRun = _testData.getOneCellValue(i, 1); ////// string sTotalEE = _testData.getOneCellValue(i, 2); ////// string sRunType = _testData.getOneCellValue(i, 3); ////// string sClientShortName = _testData.getOneCellValue(i, 4); ////// string sClient = _testData.getOneCellValue(i, 5); ////// string sPlan = _testData.getOneCellValue(i, 6); ////// string sServiceType = _testData.getOneCellValue(i, 7); ////// string sServiceName = _testData.getOneCellValue(i, 8); ////// string sNode = _testData.getOneCellValue(i, 9); ////// string sRowMax = _testData.getOneCellValue(i, 10); ////// string sColMax = _testData.getOneCellValue(i, 11); ////// string sRow = _testData.getOneCellValue(i, 12); ////// string sCol = _testData.getOneCellValue(i, 13); ////// string sRunStatus = _testData.getOneCellValue(i, 14); ////// if (sRun.ToUpper().Equals("YES")) ////// { ////// nodelist.Add(new Node(sClient, sPlan, sServiceType, sServiceName, sNode, sRowMax, sColMax, sRow, sCol, sRunStatus, 0, 0, sRunType)); ////// } //////} //////_testData.CloseExcelApplication(); #endregion ////////_gLib._MsgBoxYesNo("Total Num of Clients to Run", nodelist.Count.ToString()); mLog.LogInfo(iTimeStart, DateTime.Now.ToString()); #region ER Run for (int i = 0; i < nodelist.Count; i++) { string sER_ClickRun_Time = null; int iBaseline_ER_RunSubmitted = i * 7 + 4; int iBaseline_ER_ClickRun = iBaseline_ER_RunSubmitted + 1; int iBaseline_ER_GroupID = iBaseline_ER_ClickRun + 1; int iBaseline_ER_Persist = iBaseline_ER_GroupID + 1; int iBaseline_ER_Post = iBaseline_ER_Persist + 1; int iBaseline_ER_Detail = iBaseline_ER_Post + 1; int iBaseline_NumOfCores = iBaseline_ER_Detail + 1; pMain._SelectTab("Home"); dic.Clear(); dic.Add("Country", Config.eCountry.ToString()); dic.Add("Level_1", nodelist[i].sClientName); dic.Add("Level_2", nodelist[i].sPlanName); dic.Add("Level_3", nodelist[i].sValuationName); pMain._HomeTreeViewSelect_Favorites(0, dic); dic.Clear(); dic.Add("PopVerify", "Pop"); dic.Add("AddServiceInstance", ""); dic.Add("ServiceToOpen", nodelist[i].sServiceName); pMain._PopVerify_Home_RightPane(dic); pMain._SelectTab(nodelist[i].sServiceName); if (nodelist[i].sRunType == "FV Proj") { dic.Clear(); dic.Add("iMaxRowNum", nodelist[i].sMaxRowNum); dic.Add("iMaxColNum", nodelist[i].sMaxColNum); dic.Add("iSelectRowNum", nodelist[i].sRowNum); dic.Add("iSelectColNum", nodelist[i].sColNum); dic.Add("MenuItem_1", "Run"); dic.Add("MenuItem_2", "Future Valuation Population Projection"); pMain._FlowTreeRightSelect(dic); } else if (nodelist[i].sRunType == "FV Liab") { dic.Clear(); dic.Add("iMaxRowNum", nodelist[i].sMaxRowNum); dic.Add("iMaxColNum", nodelist[i].sMaxColNum); dic.Add("iSelectRowNum", nodelist[i].sRowNum); dic.Add("iSelectColNum", nodelist[i].sColNum); dic.Add("MenuItem_1", "Run"); dic.Add("MenuItem_2", "Future Valuation Liabilities"); pMain._FlowTreeRightSelect(dic); } else if (nodelist[i].sPlanName == "QA US Benchmark 017 Cloud Plan" & nodelist[i].sServiceName == "NDT 2017") { dic.Clear(); dic.Add("iMaxRowNum", ""); dic.Add("iMaxColNum", ""); dic.Add("iSelectRowNum", ""); dic.Add("iSelectColNum", ""); dic.Add("iPosX", "245"); dic.Add("iPosY", "90"); dic.Add("MenuItem_1", "Run"); dic.Add("MenuItem_2", "Liabilities"); pMain._FlowTreeRightSelect(dic); } else { dic.Clear(); dic.Add("iMaxRowNum", nodelist[i].sMaxRowNum); dic.Add("iMaxColNum", nodelist[i].sMaxColNum); dic.Add("iSelectRowNum", nodelist[i].sRowNum); dic.Add("iSelectColNum", nodelist[i].sColNum); dic.Add("MenuItem_1", "Run"); dic.Add("MenuItem_2", "Liabilities"); pMain._FlowTreeRightSelect(dic); } if (nodelist[i].sClientName == "QA US Benchmark 011 Cloud" & nodelist[i].sServiceName == "val 7.1.2019") { dic.Clear(); dic.Add("PopVerify", "Pop"); dic.Add("RunValuation", "Click"); dic.Add("OK", ""); pMain._PopVerify_RunOptions(dic); if (_gLib._Exists("CascadingUnlock", pMain.wCascadingUnlock.wIAgreeToUnlock.chkIAgreeToUnlock, 10, false)) { dic.Clear(); dic.Add("PopVerify", "Pop"); dic.Add("IAgreeToUnlock", "True"); dic.Add("OK", "Click"); pMain._PopVerify_CascadingUnlock(dic); } } else if (nodelist[i].sRunType == "FV Proj") { if (_gLib._Exists("CascadingUnlock", pMain.wCascadingUnlock.wIAgreeToUnlock.chkIAgreeToUnlock, 10, false)) { dic.Clear(); dic.Add("PopVerify", "Pop"); dic.Add("IAgreeToUnlock", "True"); dic.Add("OK", "Click"); pMain._PopVerify_CascadingUnlock(dic); } } else { dic.Clear(); dic.Add("PopVerify", "Pop"); dic.Add("RunValuation", "Click"); dic.Add("OK", ""); pMain._PopVerify_RunOptions(dic); } mTime.StartTimer(); sER_ClickRun_Time = DateTime.Now.ToString(); //node.setClickRunTime(sER_ClickRun_Time); mLog.LogInfo(iBaseline_ER_ClickRun, sER_ClickRun_Time); if (nodelist[i].sRunType == "FV Proj") { } else { dic.Clear(); dic.Add("PopVerify", "Pop"); dic.Add("OK", "Click"); pMain._PopVerify_EnterpriseRunSubmitted(dic); } mTime.StopTimer(iBaseline_ER_RunSubmitted); pMain._SelectTab(nodelist[i].sServiceName); int iCol_Memory; string _sER_ReturnRunStatus_ClickRun = null; MyExcel _excelLog = new MyExcel(sLogFile, true); _excelLog.OpenExcelFile("Sheet1"); iCol_Memory = _excelLog.getColumnIndex(sCol_Memory); _sER_ReturnRunStatus_ClickRun = _excelLog.getOneCellValue(iBaseline_ER_ClickRun, iCol_Memory); _excelLog.CloseExcelApplication(); DateTime _tER_ReturnRunStatus_ClickRun = Convert.ToDateTime(_sER_ReturnRunStatus_ClickRun); if (nodelist[i].sPlanName == "QA US Benchmark 017 Cloud Plan" & nodelist[i].sServiceName == "NDT 2017") { dic.Clear(); dic.Add("iMaxRowNum", nodelist[i].sMaxRowNum); dic.Add("iMaxColNum", nodelist[i].sMaxColNum); dic.Add("iSelectRowNum", ""); dic.Add("iSelectColNum", ""); dic.Add("iPosX", "245"); dic.Add("iPosY", "90"); dic.Add("MenuItem_1", "View Run Status"); pMain._FlowTreeRightSelect(dic); } else { dic.Clear(); dic.Add("iMaxRowNum", nodelist[i].sMaxRowNum); dic.Add("iMaxColNum", nodelist[i].sMaxColNum); dic.Add("iSelectRowNum", nodelist[i].sRowNum); dic.Add("iSelectColNum", nodelist[i].sColNum); dic.Add("MenuItem_1", "View Run Status"); pMain._FlowTreeRightSelect(dic); } if (nodelist[i].sRunType == "FV Proj") { pMain._EnterpriseRun("Group Job Successfully Complete", true, "FV Proj"); } else if (nodelist[i].sRunType == "FV Liab") { pMain._EnterpriseRun("Group Job Successfully Complete", true, "FV Liab"); } else { pMain._EnterpriseRun(nodelist[i].sRunStatus, true); } string _sER_ReturnRunStatus_BottomGrid_Persist = pMain._ER_ReturnRunStatus_BottomGrid("Job State History", 3, 5); string _sER_ReturnRunStatus_BottomGrid_Post = pMain._ER_ReturnRunStatus_BottomGrid("Job State History", 4, 5); DateTime _tER_ReturnRunStatus_BottomGrid_Persist = Convert.ToDateTime(_sER_ReturnRunStatus_BottomGrid_Persist); DateTime _tER_ReturnRunStatus_BottomGrid_Post = Convert.ToDateTime(_sER_ReturnRunStatus_BottomGrid_Post); string _sER_ReturnRunStatus_BottomGrid_JobSent = pMain._ER_ReturnRunStatus_BottomGrid("Job State History", 2, 5); string _sER_ReturnRunStatus_BottomGrid_JobStatus; if (nodelist[i].sRunType == "FV Proj") { _sER_ReturnRunStatus_BottomGrid_JobStatus = pMain._ER_ReturnRunStatus_BottomGrid("Job Status Info", 1, 12); } else { _sER_ReturnRunStatus_BottomGrid_JobStatus = pMain._ER_ReturnRunStatus_BottomGrid("Job Status Info", 2, 12); } string _sER_ReturnRunStatus_BottomGrid_GroupJobStatus = pMain._ER_ReturnRunStatus_TopGrid(11); DateTime _tER_ReturnRunStatus_BottomGrid_JobSent = Convert.ToDateTime(_sER_ReturnRunStatus_BottomGrid_JobSent); DateTime _tER_ReturnRunStatus_BottomGrid_JobStatus = Convert.ToDateTime(_sER_ReturnRunStatus_BottomGrid_JobStatus); DateTime _tER_ReturnRunStatus_BottomGrid_GroupJobStatus = Convert.ToDateTime(_sER_ReturnRunStatus_BottomGrid_GroupJobStatus); mLog.LogInfo(iBaseline_ER_GroupID, pMain._ER_ReturnRunStatus_TopGrid(2)); mLog.LogInfo(iBaseline_ER_Persist, _sER_ReturnRunStatus_BottomGrid_Persist); mLog.LogInfo(iBaseline_ER_Post, _sER_ReturnRunStatus_BottomGrid_Post); sERDetail = ""; sERDetail = sERDetail + "Earliest Process: " + _sER_ReturnRunStatus_BottomGrid_JobSent + Environment.NewLine; sERDetail = sERDetail + "Job Success: " + _sER_ReturnRunStatus_BottomGrid_JobStatus + Environment.NewLine; sERDetail = sERDetail + "Group Job Success: " + _sER_ReturnRunStatus_BottomGrid_GroupJobStatus + Environment.NewLine; mLog.LogInfo(iBaseline_ER_Detail, sERDetail); sERDetail = ""; sERDetail = pMain._ER_ReturnRunStatus_BottomGrid("Job Status Info", 1, 3); mLog.LogInfo(iBaseline_NumOfCores, sERDetail); TimeSpan _tPersist = _tER_ReturnRunStatus_BottomGrid_Post - _tER_ReturnRunStatus_BottomGrid_Persist; TimeSpan _tPost = _tER_ReturnRunStatus_BottomGrid_JobStatus - _tER_ReturnRunStatus_BottomGrid_Post; TimeSpan _tJobSent_Persist = _tER_ReturnRunStatus_BottomGrid_Persist - _tER_ReturnRunStatus_BottomGrid_JobSent; TimeSpan _tClickRun_GroupJobStatus = _tER_ReturnRunStatus_BottomGrid_GroupJobStatus - _tER_ReturnRunStatus_ClickRun; int _tOverall = (_tClickRun_GroupJobStatus.Hours * 3600 + _tClickRun_GroupJobStatus.Minutes * 60 + _tClickRun_GroupJobStatus.Seconds) - (_tJobSent_Persist.Hours * 3600 + _tJobSent_Persist.Minutes * 60 + _tJobSent_Persist.Seconds); mLogTime.LogInfo(iBaseline_ER_Persist, Convert.ToString(_tPersist.Hours * 3600 + _tPersist.Minutes * 60 + _tPersist.Seconds)); mLogTime.LogInfo(iBaseline_ER_Post, Convert.ToString(_tPost.Hours * 3600 + _tPost.Minutes * 60 + _tPost.Seconds)); mLogTime.LogInfo(iBaseline_ER_ClickRun, Convert.ToString(_tOverall)); mLogTime.LogInfo(iBaseline_NumOfCores, this._ReturnCores(sERDetail)); pMain._SelectTab(nodelist[i].sServiceName); pMain._Home_ToolbarClick_Top(false); } #endregion mLog.LogInfo(iTimeEnd, DateTime.Now.ToString()); _gLib._MsgBox("Congratulations!", "Finished!"); }