Ejemplo n.º 1
0
        public void ValidateLoginWithoutCredentials()
        {
            String expected = "Please enter at least 5 characters.";

            test = extent.CreateTest("Validate Login Without Credentials",
                                     "When user enters no credentials, user should be displayed with error message.");
            loginPage = new LoginPage(driver, test);

            try
            {
                loginPage.EnterUserName("p");

                String actual = loginPage.GetUserNameError();

                test.AddScreenCaptureFromPath(TakeScreenshot(driver));
                Assert.AreEqual(expected, actual, "User displayed with error message.");
                addTestCaseStatus("Pass", testcaseID, "Test Case Passed");
                test.Pass("User displayed with error message.");
            }
            catch (AssertionException)
            {
                addTestCaseStatus("Fail", testcaseID, "Test Case Failed");
                test.Fail("User is not displayed with error message.");
                throw;
            }
        }
Ejemplo n.º 2
0
        public void ValidateLoginWithValidCredentials()
        {
            String expected = "Unity - Game Engine";

            test = extent.CreateTest("Validate Login With Valid Credentials",
                                     "When user enters valid credentials, user should navigate to home page.");
            loginPage = new LoginPage(driver, test);

            try
            {
                loginPage.EnterUserName("pravin");
                loginPage.EnterPassword("pravin");
                loginPage.ClickLogin();
                String actual = loginPage.GetTitle();

                test.AddScreenCaptureFromPath(TakeScreenshot(driver));
                Assert.AreEqual(expected, actual, "Page Navigated to Home Page.");
                addTestCaseStatus("Pass", testcaseID, "Test Case Passed");
                test.Pass("User navigated to home page.");
            }
            catch (AssertionException)
            {
                addTestCaseStatus("Fail", testcaseID, "Test Case Failed");
                test.Fail("User did navigate to home page.");
                throw;
            }
        }