public void AddExtraControls(string name, ExtraControls c) { _controls.Add(c); var page = new TabPage(name); page.Padding = new System.Windows.Forms.Padding(3); page.UseVisualStyleBackColor = true; page.Controls.Add(c); _pages.TabPages.Add(page); _pages.SelectedTab = page; }
//[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "C:\\Bag_Receipt_Data\\Bag_Receipt.csv", "Bag_Receipt#csv", DataAccessMethod.Sequential), TestMethod] public void CodedUITestMethod1() { Log.Write("Test Case Execution Started"); Log.Write("=========================================================="); Log.Write("\n"); for (int testcaseCount = 1; testcaseCount < Users.listA.Count; testcaseCount++) { Log.Write("Test Case:" + testcaseCount); Log.Write("-----------------------------------------------------------"); try { string aTMID = Users.listA[testcaseCount]; if (Users.listA[testcaseCount].Length > 2) { aTMID = Users.listA[testcaseCount].Substring(1, 4); } string operations = Users.listC[testcaseCount]; if (operations.Contains("Logout")) { operations = Users.listC[testcaseCount].Substring(1, 6); } else { operations = Users.listC[testcaseCount].Substring(1, 8); } string date = Users.listB[testcaseCount]; if (Users.listB[testcaseCount].Length > 2) { date = Users.listB[testcaseCount].Substring(1, 10); } if (aTMID.Length > 2) { aTMID = aTMID.Substring(0, 4); } this.UIMap.Bag_ReciptParams.UIItemEditText = aTMID; this.UIMap.Bag_ReciptParams.UIItemListSelectedItemsAsString = date; if (operations == "Fill ATM") { try { if (counter == 0) { //Process.Start(@"D:\ImageMark\bin\TskMgrOI.exe"); //this.UIMap.ListItemABMDEP3(); //this.UIMap.ListItemATMAdmin(); //System.Threading.Thread.Sleep(5000); } this.UIMap.Bag_Recipt(); Log.Write("Test Case:" + testcaseCount + "succeed"); Log.Write("-----------------------------------------------------------"); Log.Write("\n"); counter++; } catch (Exception ex) { Log.Write("Test case:" + testcaseCount + "Encountered Exception For ATM Already been processed or for Invalid ATM"); Log.Write("-----------------------------------------------------------"); Log.Write("\n"); counter++; ExtraControls objExtraControls = new ExtraControls(); bool noRecordFound = objExtraControls.NoRecordFoundText(); if (noRecordFound == true) { Log.Write("No Record for the ATM found or ATM already been processed"); Log.Write("-----------------------------------------------------------"); Log.Write("\n"); objExtraControls.NoRecordFoundOkBtn(); } iNVALIDaTM objiNVALIDaTM = new iNVALIDaTM(); bool invalidAtm = objiNVALIDaTM.InvlidAtmText(); if (invalidAtm == true) { Log.Write("ATM is InValid"); Log.Write("-----------------------------------------------------------"); Log.Write("\n"); objiNVALIDaTM.InvlidAtmBtn(); } } } else if (operations == "Logout") { Log.Write("=========================================================="); Log.Write("Logout"); Log.Write("=========================================================="); LogOut objLogOut = new LogOut(); objLogOut.LogOut1(); //ExitApplication objExitApplication = new ExitApplication(); //objExitApplication.CloseApplication(); //System.Threading.Thread.Sleep(1000); //objExitApplication.ConfirmationYes(); } } catch (Exception ex) { Log.Write("test Case:" + testcaseCount + "Failed"); Log.Write(ex.ToString()); Log.Write("-----------------------------------------------------------"); Log.Write("\n"); continue; } } // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463 Log.Write("=========================================================="); Logger.Log.Write("Test case execution completed"); Log.Write("\n"); Log.Write("=========================================================="); Log.Write("File Closed"); Log.Write("=========================================================="); Logger.Log.CloseFile(); }