static void Test(Test axe) { axe.InitializeTestDataSource("OPAD002", "", (axe.IsDataDriven("") ? axe.DataFileRowCount : 0), (axe.IsDataDriven("") ? axe.DataFileCurrentRow : 0)); if (!axe.AssertIterationInScope(true)) { return; } AxeHarness harness = new AxeHarness(new Settings(axe.GetRunCategoryOptions("AxeHarness"))); Driver driver = null; try { driver = new Driver(axe, @"C:\Program Files (x86)\Odin Technology\Axe\Selenium", "Example", "OPAD002"); axe.jobId = driver.GetRemoteSessionId().ToString(); } catch (Exception e) { axe.TraceError("Cannot initialize Selenium " + e.ToString()); Environment.Exit(1); } try { axe.TestBegin("OPAD002", "Check user account details are correct (expected Fail)", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "MyTests", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/results/debug/results.xml", ""); axe.BasestateBegin("Restart.Home"); driver.WebDriver.Navigate().GoToUrl(axe.GetRunCategoryOption("website", "Home")); axe.BasestateEnd(); // // axe.SubtestBegin("selectLogin", "Select Login from the main menu", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Home"); axe.StepBegin("[]Home", @"set", @""); driver.SetWindow("title=Odin Portal"); axe.StepEnd(); axe.StepBegin("MenuLogin", @"set", @""); driver.FindElement("//a[text()='Login']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("withUser1", "Enter valid login credentials for an existing user", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Login"); axe.StepBegin("[]Login", @"set", @""); driver.SetWindow("title=Odin Portal - Login"); axe.StepEnd(); axe.StepBegin("UserID", @"set", @"*****@*****.**"); driver.FindElement("name=TextBoxUserId").SendKeys("*****@*****.**"); axe.StepEnd(); axe.StepBegin("Password", @"set", @"abc123"); driver.FindElement("name=TextBoxPassword").SendKeys("abc123"); axe.StepEnd(); axe.StepBegin("Login", @"set", @""); driver.FindElement("//input[@value='Login']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("selectAccountDetails", "Select Account Details from the main menu", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Home"); axe.StepBegin("[]Home", @"set", @""); driver.SetWindow("title=Odin Portal"); axe.StepEnd(); axe.StepBegin("MenuAccountDetails", @"set", @""); driver.FindElement("//a[text()='Account Details']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("checkUser1", "Validate account details for user1 (expected Fail on DOB)", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "AccountDetails"); axe.StepBegin("[]AccountDetails", @"set", @""); driver.SetWindow("title=Odin Portal - Account Details"); axe.StepEnd(); axe.StepBegin("Title", @"get", @"Mr"); axe.Value = driver.FindCellElement("AccountDetails.0.1").Text; axe.StepEnd(); axe.StepBegin("Title", @"val", @"Mr"); axe.StepValidateEqual(@"Mr", axe.Value); axe.StepEnd(); axe.StepBegin("Name", @"get", @"John Smith"); axe.Value = driver.FindCellElement("AccountDetails.1.1").Text; axe.StepEnd(); axe.StepBegin("Name", @"val", @"John Smith"); axe.StepValidateEqual(@"John Smith", axe.Value); axe.StepEnd(); axe.StepBegin("Gender", @"get", @"Male"); axe.Value = driver.FindCellElement("AccountDetails.2.1").Text; axe.StepEnd(); axe.StepBegin("Gender", @"val", @"Male"); axe.StepValidateEqual(@"Male", axe.Value); axe.StepEnd(); axe.StepBegin("DOB", @"get", @"04/01/1980"); axe.Value = driver.FindCellElement("AccountDetails.3.1").Text; axe.StepEnd(); axe.StepBegin("DOB", @"val", @"04/01/1980"); axe.StepValidateEqual(@"04/01/1980", axe.Value); axe.StepEnd(); axe.StepBegin("Email", @"get", @"*****@*****.**"); axe.Value = driver.FindCellElement("AccountDetails.4.1").Text; axe.StepEnd(); axe.StepBegin("Email", @"val", @"*****@*****.**"); axe.StepValidateEqual(@"*****@*****.**", axe.Value); axe.StepEnd(); axe.SubtestEnd(); // // } catch (Exception ex) { axe.StepInfo(ex.Message); driver.TakeScreenshot(axe.FilenameForScreenshot()); axe.TestAbort(); executeTestEnd = false; } finally { driver.Abort(); } if (executeTestEnd) { axe.TestEnd(); } else { executeTestEnd = true; } }
static void Test(Test axe) { axe.InitializeTestDataSource("OPRG001", "", (axe.IsDataDriven("") ? axe.DataFileRowCount : 0), (axe.IsDataDriven("") ? axe.DataFileCurrentRow : 0)); if (!axe.AssertIterationInScope(true)) { return; } AxeHarness harness = new AxeHarness(new Settings(axe.GetRunCategoryOptions("AxeHarness"))); Driver driver = null; try { driver = new Driver(axe, @"C:\Program Files (x86)\Odin Technology\Axe\Selenium", "Example", "OPRG001"); axe.jobId = driver.GetRemoteSessionId().ToString(); } catch (Exception e) { axe.TraceError("Cannot initialize Selenium " + e.ToString()); Environment.Exit(1); } try { axe.TestBegin("OPRG001", "Verify registration of a new user - all possible info", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "MyTests", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/results/debug/results.xml", ""); axe.BasestateBegin("Restart.Home"); driver.WebDriver.Navigate().GoToUrl(axe.GetRunCategoryOption("website", "Home")); axe.BasestateEnd(); // // axe.SubtestBegin("selectRegister", "Select Register from the main menu", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Home"); axe.StepBegin("[]Home", @"set", @""); driver.SetWindow("title=Odin Portal"); axe.StepEnd(); axe.StepBegin("MenuRegister", @"set", @""); driver.FindElement("//a[text()='Register']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("usingNewUser1", "Register a new user with all possible information", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Register"); axe.StepBegin("[]Register", @"set", @""); driver.SetWindow("title=Odin Portal - Register"); axe.StepEnd(); axe.StepBegin("Title", @"set", @"Mr"); driver.FindSelectElement("name=title").SelectByText("Mr"); axe.StepEnd(); axe.StepBegin("Name", @"set", @"Adam Brown"); driver.FindElement("name=TextBoxName").SendKeys("Adam Brown"); axe.StepEnd(); axe.StepBegin("Male", @"set", @""); driver.FindElement("//input[@value='male']").Click(); axe.StepEnd(); axe.StepBegin("DOB", @"set", @"01/12/1975"); driver.FindElement("name=DOB").SendKeys("01/12/1975"); axe.StepEnd(); axe.StepBegin("Email", @"set", @"*****@*****.**"); driver.FindElement("name=email").SendKeys("*****@*****.**"); axe.StepEnd(); axe.StepBegin("MailingList", @"set", @"1"); driver.FindElement("name=MailingList").Select(axe.ConvertDataToBoolean("1", true)); axe.StepEnd(); axe.StepBegin("Register", @"set", @""); driver.FindElement("//a[text()='Register']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("pageDisplayed", "Check that registration has been successful", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "RegisterSuccess"); axe.StepBegin("[]RegisterSuccess", @"set", @""); driver.SetWindow("title=Odin Portal - Register Success"); axe.StepEnd(); axe.SubtestEnd(); // // } catch (Exception ex) { axe.StepInfo(ex.Message); driver.TakeScreenshot(axe.FilenameForScreenshot()); axe.TestAbort(); executeTestEnd = false; } finally { driver.Abort(); } if (executeTestEnd) { axe.TestEnd(); } else { executeTestEnd = true; } }
static void Test(Test axe) { axe.InitializeTestDataSource("OPRG010", "", (axe.IsDataDriven("") ? axe.DataFileRowCount : 0), (axe.IsDataDriven("") ? axe.DataFileCurrentRow : 0)); if (!axe.AssertIterationInScope(true)) { return; } AxeHarness harness = new AxeHarness(new Settings(axe.GetRunCategoryOptions("AxeHarness"))); Driver driver = null; try { driver = new Driver(axe, @"C:\Program Files (x86)\Odin Technology\Axe\Selenium", "Example", "OPRG010"); axe.jobId = driver.GetRemoteSessionId().ToString(); } catch (Exception e) { axe.TraceError("Cannot initialize Selenium " + e.ToString()); Environment.Exit(1); } try { axe.TestBegin("OPRG010", "Check default field values for new user registration", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "MyTests", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/results/debug/results.xml", ""); axe.BasestateBegin("Home"); driver.WebDriver.Navigate().GoToUrl(axe.GetRunCategoryOption("website", "Home")); axe.BasestateEnd(); // // axe.SubtestBegin("selectRegister", "Select Register from the main menu", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Home"); axe.StepBegin("[]Home", @"set", @""); driver.SetWindow("title=Odin Portal"); axe.StepEnd(); axe.StepBegin("MenuRegister", @"set", @""); driver.FindElement("//a[text()='Register']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("checkDefault", "Check registration defaults", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Register"); axe.StepBegin("[]Register", @"set", @""); driver.SetWindow("title=Odin Portal - Register"); axe.StepEnd(); axe.StepBegin("Title", @"get", @"Mr"); axe.Value = driver.FindSelectElement("name=title").AllSelectedOptions.Count > 0 ? driver.FindSelectElement("name=title").SelectedOption.Text : ""; axe.StepEnd(); axe.StepBegin("Title", @"val", @"Mr"); axe.StepValidateEqual(@"Mr", axe.Value); axe.StepEnd(); axe.StepBegin("Name", @"get", @""); axe.Value = driver.FindElement("name=TextBoxName").GetAttribute("value"); axe.StepEnd(); axe.StepBegin("Name", @"val", @""); axe.StepValidateEqual(@"", axe.Value); axe.StepEnd(); axe.StepBegin("Male", @"get", @"0"); axe.Value = Convert.ToInt32(driver.FindElement("//input[@value='male']").Selected).ToString(); axe.StepEnd(); axe.StepBegin("Male", @"val", @"0"); axe.StepValidateEqual(@"0", axe.Value); axe.StepEnd(); axe.StepBegin("Female", @"get", @"0"); axe.Value = Convert.ToInt32(driver.FindElement("//input[@value='female']").Selected).ToString(); axe.StepEnd(); axe.StepBegin("Female", @"val", @"0"); axe.StepValidateEqual(@"0", axe.Value); axe.StepEnd(); axe.StepBegin("DOB", @"get", @""); axe.Value = driver.FindElement("name=DOB").GetAttribute("value"); axe.StepEnd(); axe.StepBegin("DOB", @"val", @""); axe.StepValidateEqual(@"", axe.Value); axe.StepEnd(); axe.StepBegin("Email", @"get", @""); axe.Value = driver.FindElement("name=email").GetAttribute("value"); axe.StepEnd(); axe.StepBegin("Email", @"val", @""); axe.StepValidateEqual(@"", axe.Value); axe.StepEnd(); axe.StepBegin("MailingList", @"get", @"0"); axe.Value = Convert.ToInt32(driver.FindElement("name=MailingList").Selected).ToString(); axe.StepEnd(); axe.StepBegin("MailingList", @"val", @"0"); axe.StepValidateEqual(@"0", axe.Value); axe.StepEnd(); axe.SubtestEnd(); // // } catch (Exception ex) { axe.StepInfo(ex.Message); driver.TakeScreenshot(axe.FilenameForScreenshot()); axe.TestAbort(); executeTestEnd = false; } finally { driver.Abort(); } if (executeTestEnd) { axe.TestEnd(); } else { executeTestEnd = true; } }
static void Test(Test axe) { axe.InitializeTestDataSource("OPRG100_01", "", (axe.IsDataDriven("") ? axe.DataFileRowCount : 0), (axe.IsDataDriven("") ? axe.DataFileCurrentRow : 0)); if (!axe.AssertIterationInScope(true)) { return; } AxeHarness harness = new AxeHarness(new Settings(axe.GetRunCategoryOptions("AxeHarness"))); Driver driver = null; try { driver = new Driver(axe, @"C:\Program Files (x86)\Odin Technology\Axe\Selenium", "Example", "OPRG100_01"); axe.jobId = driver.GetRemoteSessionId().ToString(); } catch (Exception e) { axe.TraceError("Cannot initialize Selenium " + e.ToString()); Environment.Exit(1); } try { axe.TestBegin("OPRG100_01", "Register a new user and save password", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "MyTests", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/results/debug/results.xml", ""); axe.BasestateBegin("Restart.Home"); driver.WebDriver.Navigate().GoToUrl(axe.GetRunCategoryOption("website", "Home")); axe.BasestateEnd(); // // axe.SubtestBegin("selectRegister", "Select Register from the main menu", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Home"); axe.StepBegin("[]Home", @"set", @""); driver.SetWindow("title=Odin Portal"); axe.StepEnd(); axe.StepBegin("MenuRegister", @"set", @""); driver.FindElement("//a[text()='Register']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("usingNewUser100", "Register a user for login testing", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Register"); axe.StepBegin("[]Register", @"set", @""); driver.SetWindow("title=Odin Portal - Register"); axe.StepEnd(); axe.StepBegin("Title", @"set", @"Mr"); driver.FindSelectElement("name=title").SelectByText("Mr"); axe.StepEnd(); axe.StepBegin("Name", @"set", @"Fred White"); driver.FindElement("name=TextBoxName").SendKeys("Fred White"); axe.StepEnd(); axe.StepBegin("Male", @"set", @""); driver.FindElement("//input[@value='male']").Click(); axe.StepEnd(); axe.StepBegin("DOB", @"set", @"30/03/1978"); driver.FindElement("name=DOB").SendKeys("30/03/1978"); axe.StepEnd(); axe.StepBegin("Email", @"set", @"*****@*****.**"); driver.FindElement("name=email").SendKeys("*****@*****.**"); axe.StepEnd(); axe.StepBegin("Register", @"set", @""); driver.FindElement("//a[text()='Register']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("saveUser100Password", "Save new users password", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "RegisterSuccess"); axe.StepBegin("[]RegisterSuccess", @"set", @""); driver.SetWindow("title=Odin Portal - Register Success"); axe.StepEnd(); axe.StepBegin("Password", @"get", @""); axe.Value = driver.FindElement("id=password").Text; axe.StepEnd(); axe.StepBegin("Password", @"save", @""); axe.DataSave("Password", "", axe.Value); axe.StepEnd(); axe.SubtestEnd(); // // } catch (Exception ex) { axe.StepInfo(ex.Message); driver.TakeScreenshot(axe.FilenameForScreenshot()); axe.TestAbort(); executeTestEnd = false; } finally { driver.Abort(); } if (executeTestEnd) { axe.TestEnd(); } else { executeTestEnd = true; } }
static void Test(Test axe) { axe.InitializeTestDataSource("OPLO001", "", (axe.IsDataDriven("") ? axe.DataFileRowCount : 0), (axe.IsDataDriven("") ? axe.DataFileCurrentRow : 0)); if (!axe.AssertIterationInScope(true)) { return; } AxeHarness harness = new AxeHarness(new Settings(axe.GetRunCategoryOptions("AxeHarness"))); Driver driver = null; try { driver = new Driver(axe, @"C:\Program Files (x86)\Odin Technology\Axe\Selenium", "Example", "OPLO001"); axe.jobId = driver.GetRemoteSessionId().ToString(); } catch (Exception e) { axe.TraceError("Cannot initialize Selenium " + e.ToString()); Environment.Exit(1); } try { axe.TestBegin("OPLO001", "Verify that logout screen is displayed when logging off (expected Abort)", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "MyTests", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/results/debug/results.xml", ""); axe.BasestateBegin("Restart.Home"); driver.WebDriver.Navigate().GoToUrl(axe.GetRunCategoryOption("website", "Home")); axe.BasestateEnd(); // // axe.SubtestBegin("selectLogin", "Select Login from the main menu", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Home"); axe.StepBegin("[]Home", @"set", @""); driver.SetWindow("title=Odin Portal"); axe.StepEnd(); axe.StepBegin("MenuLogin", @"set", @""); driver.FindElement("//a[text()='Login']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("withUser1", "Enter valid login credentials for an existing user", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Login"); axe.StepBegin("[]Login", @"set", @""); driver.SetWindow("title=Odin Portal - Login"); axe.StepEnd(); axe.StepBegin("UserID", @"set", @"*****@*****.**"); driver.FindElement("name=TextBoxUserId").SendKeys("*****@*****.**"); axe.StepEnd(); axe.StepBegin("Password", @"set", @"abc123"); driver.FindElement("name=TextBoxPassword").SendKeys("abc123"); axe.StepEnd(); axe.StepBegin("Login", @"set", @""); driver.FindElement("//input[@value='Login']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("selectLogout", "Select Logout from the main menu", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Home"); axe.StepBegin("[]Home", @"set", @""); driver.SetWindow("title=Odin Portal"); axe.StepEnd(); axe.StepBegin("MenuLogout", @"set", @""); driver.FindElement("//a[text()='Logout']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("pageDisplayed", "Check that Logout page appears", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Logout"); axe.StepBegin("[]Logout", @"set", @""); driver.SetWindow("title=Odin Portal - Logout"); axe.StepEnd(); axe.SubtestEnd(); // // } catch (Exception ex) { axe.StepInfo(ex.Message); driver.TakeScreenshot(axe.FilenameForScreenshot()); axe.TestAbort(); executeTestEnd = false; } finally { driver.Abort(); } if (executeTestEnd) { axe.TestEnd(); } else { executeTestEnd = true; } }
static void Test(Test axe) { axe.InitializeTestDataSource("OPLI010", "", (axe.IsDataDriven("") ? axe.DataFileRowCount : 0), (axe.IsDataDriven("") ? axe.DataFileCurrentRow : 0)); if (!axe.AssertIterationInScope(true)) { return; } AxeHarness harness = new AxeHarness(new Settings(axe.GetRunCategoryOptions("AxeHarness"))); Driver driver = null; try { driver = new Driver(axe, @"C:\Program Files (x86)\Odin Technology\Axe\Selenium", "Example", "OPLI010"); axe.jobId = driver.GetRemoteSessionId().ToString(); } catch (Exception e) { axe.TraceError("Cannot initialize Selenium " + e.ToString()); Environment.Exit(1); } try { axe.TestBegin("OPLI010", "Login as admin user and validate role", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "MyTests", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/results/debug/results.xml", ""); axe.BasestateBegin("Restart.Home"); driver.WebDriver.Navigate().GoToUrl(axe.GetRunCategoryOption("website", "Home")); axe.BasestateEnd(); // // axe.SubtestBegin("selectLogin", "Select Login from the main menu", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Home"); axe.StepBegin("[]Home", @"set", @""); driver.SetWindow("title=Odin Portal"); axe.StepEnd(); axe.StepBegin("MenuLogin", @"set", @""); driver.FindElement("//a[text()='Login']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("withAdmin", "Login in as administrator", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Login"); axe.StepBegin("[]Login", @"set", @""); driver.SetWindow("title=Odin Portal - Login"); axe.StepEnd(); axe.StepBegin("UserID", @"set", @"admin"); driver.FindElement("name=TextBoxUserId").SendKeys("admin"); axe.StepEnd(); axe.StepBegin("Password", @"set", @"xyz999"); driver.FindElement("name=TextBoxPassword").SendKeys("xyz999"); axe.StepEnd(); axe.StepBegin("Login", @"set", @""); driver.FindElement("//input[@value='Login']").Click(); axe.StepEnd(); axe.SubtestEnd(); // // axe.SubtestBegin("checkAdmin", "Check that logged in user is an administrator", "C:/Users/knzul/OneDrive/Documents/Axe Projects/Example/data/ExampleTests.xlsx", "Home"); axe.StepBegin("[]Home", @"set", @""); driver.SetWindow("title=Odin Portal"); axe.StepEnd(); axe.StepBegin("Role", @"get", @"Administrator"); axe.Value = driver.FindElement("id=role").Text; axe.StepEnd(); axe.StepBegin("Role", @"val", @"Administrator"); axe.StepValidateEqual(@"Administrator", axe.Value); axe.StepEnd(); axe.SubtestEnd(); // // } catch (Exception ex) { axe.StepInfo(ex.Message); driver.TakeScreenshot(axe.FilenameForScreenshot()); axe.TestAbort(); executeTestEnd = false; } finally { driver.Abort(); } if (executeTestEnd) { axe.TestEnd(); } else { executeTestEnd = true; } }
public void Abort() { ClearInput(); Driver.Abort(); }