Friday, 4 August 2017

Test Script - Verify Login Logout

package com.test.automation.uiAutomation.loginPage;

import java.io.IOException;

import org.apache.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.test.automation.uiAutomation.testBase.TestBase;
import com.test.automation.uiAutomation.uiActions.LoginPage;

/**
 * @Blog Name : Selenium Code Example
 * @author Deepak Gupta
 * @Created Date 31-07-2017
 *
 */

public class TC003_VerifyLoginLogout extends TestBase {

public static final Logger log = Logger.getLogger(TC003_VerifyLoginLogout.class.getName());
LoginPage loginPage;

@BeforeClass
public void setUp() throws IOException {
init();
}

@Test
public void verifyLogin() throws InterruptedException {
try {
log.info("============= Starting verifyLogin Test =============");
loginPage = new LoginPage(driver);
loginPage.loginToApplication("qadeepak", "1");
Thread.sleep(2000);
Assert.assertEquals(loginPage.getTitleName(), "Dashboard");
log.info("============= Finished verifyLogin Test =============");
} catch (Exception e) {
log.error("Exception is: " + e.getMessage());
}
}

@Test(dependsOnMethods = "verifyLogin", enabled = false)
public void verifyLogout() {
try {
log.info("============= Starting verifyLogout Test =============");
loginPage = new LoginPage(driver);
Assert.assertEquals(loginPage.getTitleName(), "JobSpot");
log.info("============= Finished verifyLogout Test =============");
} catch (Exception e) {
log.error("Exception is: " + e.getMessage());
}
}

}

No comments:

Post a Comment

Code Example - File Download By Robot Class In Firefox Browser

Exported from Notepad++ package com . practiceCode ; import java . awt . AWTException ; import java . awt . Robot ; import j...