public void ShopingTest() { Excel.Worksheet Sheet = this.CSV.OpenCSV(@"C:\Users\Milijana\Desktop\ddt5.csv"); int rows = Sheet.UsedRange.Rows.Count; int columns = Sheet.UsedRange.Columns.Count; string name; string username; string password; for (int i = 2; i <= rows; i++) { name = Sheet.Cells[i, 1].Value; username = Sheet.Cells[i, 2].Value; password = Sheet.Cells[i, 3].Value; ShopHomePage home = new ShopHomePage(driver); home.GoToPage(); ShopLoginPage SLP; SLP = home.ClickOnLoginLink(); home = SLP.Login(username, password); string Actualy = "Prosao"; if (home.Welcome != null) { home.ClickLogout(); } else { Actualy = "Nije prosao"; } TestContext.WriteLine("Ime testa: {0}, Ussername je: {1},Password je: {2},Stanje {3}", name, username, password, Actualy); FileManagment.Scrivere("Ime: " + name + "Username: "******"Password:"******"Stanje" + Actualy); } this.CSV.Close(); }
public void ShopingTest() { string username = "******"; string password = "******"; UInt64 X = 0; UInt64 Y = 0; ShopHomePage home = new ShopHomePage(driver); home.GoToPage(); ShopLoginPage SLP; SLP = home.ClickOnLoginLink(); home = SLP.Login(username, password); if (home.Welcome != null) { Porudzbina P; home.UnesiKolicinu("3"); P = home.ClickOrder(); home = P.ClickContinueShopping(); home.UnesiKolicinuEnterprice("3"); P = home.ClickOrderEnterprise(); home = P.ClickContinueShopping(); CartPage C; C = home.ClickOnViewCart(); X = C.TotalColumn; ConfirmationPage CP; CP = C.ClickCheckout(); home = CP.ClickGoBack(); HistoryPage HP; HP = home.ClickHistory(); Y = HP.HystoryTotalColumn; if (X == Y) { TestContext.WriteLine("Successful Test!!!{0}={1}", X, Y); Assert.Pass("Successful Test!!!"); } else { Assert.Fail("The test is failed"); TestContext.WriteLine("The test is failed"); } } else { Assert.Fail("User not registered"); } }
public void QATest() { CSVHandler CSV = new CSVHandler(); Excel.Worksheet Sheet = CSV.OpenCSV(@"C:\Users\Milijana\Desktop\ddt6.csv"); int rows = Sheet.UsedRange.Rows.Count; int columns = Sheet.UsedRange.Columns.Count; string name, description, expected, FirstName, LastName, Email, UN, P, CP; bool IsExpected = true; for (int i = 2; i <= rows; i++) { TestContext.Write("Name of Test Case: {0},Description: {1},Expected: {2} ", Sheet.Cells[i, 1].Value, Sheet.Cells[i, 2].Value, Sheet.Cells[i, 3].Value); FileManagment.Scrivi("Name of Test Case: " + Sheet.Cells[i, 1].Value.ToString() + " Description: " + Sheet.Cells[i, 2].Value.ToString() + " Expected: " + Sheet.Cells[i, 3].Value); name = Sheet.Cells[i, 1].Value; description = Sheet.Cells[i, 2].Value; expected = Sheet.Cells[i, 3].Value; FirstName = Sheet.Cells[i, 4].Value; LastName = Sheet.Cells[i, 5].Value; Email = Sheet.Cells[i, 6].Value; UN = Sheet.Cells[i, 7].Value; P = Sheet.Cells[i, 8].Value; CP = Sheet.Cells[i, 9].Value; ShopHomePage pocetna = new ShopHomePage(driver); pocetna.GoToPage(); Register R; R = pocetna.ClicReg(); pocetna = R.ClickButtonRegister(FirstName, LastName, Email, UN, P, CP); if (pocetna.Uspeh != null) { if (expected == "pass") { TestContext.WriteLine(" Successful Test!!! "); FileManagment.Scrivere(" Successful Test!!! "); } else { TestContext.WriteLine(" The test is failed!!! "); FileManagment.Scrivere(" The test is failed!!! "); IsExpected = false; } } else { if (expected == "fail") { TestContext.WriteLine(" Successful Test!!! "); FileManagment.Scrivere(" Successful Test!!! "); } else { TestContext.WriteLine(" The test is failed!!! "); FileManagment.Scrivere(" Successful Test!!! "); IsExpected = false; } } TestContext.WriteLine("----------------------------------------------------------------------------------------------------------------------------------------------"); FileManagment.Scrivere("---------------------------------------------------------------------------------------------------------------------------------------------"); } if (IsExpected == true) { Assert.Pass("Great job!!!"); } else { Assert.Fail("Some test has an unexpected result!!!"); } CSV.Close(); }