package com.zzx.test;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
import com.zzx.pageObject.LoginPage;
import com.zzx.util.BaseTest;
public class LoginTest extends BaseTest{
LoginPage loginPage = new LoginPage();
String LoginURL = "http://oneadmin.peersafe.cn/logout";
/**
* ·½·¨Ãû³Æ£ºloginTest1
* ·½·¨ÃèÊö£º This method is testing the empty username
and the right password
* The end is Loginfailed ,I will print some
error information on the console and
* the page still stay on the login page
* ´´½¨ÈË£ºzzx
* ´´½¨Ê±¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* ÐÞ¸ÄÈË£ºzzx
* ÐÞ¸Äʱ¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* Ð޸ı¸×¢£º
* @version 1.0
* @throws Exception maybe some exception will
happen
*/
//¿ÕµÄÓû§ÃûºÍÕýÈ·µÄÃÜÂ룬µÇ¼ʧ°Ü£¬¿ØÖÆÌ¨Êä³ö¡°Óû§Ãû´íÎ󣡡±
@Test(priority=1)
public void loginTest1() throws Exception{
if(!loginPage.isLoginPage(driver)){
driver.get(LoginURL);
}
try {
loginPage.login(driver, "","$z58dSHE");
} catch (Exception e) {
System.out.println(e);
}
finally {
assertEquals(false, loginPage.loginStatus(driver));
}
}
/**
* ·½·¨Ãû³Æ£ºloginTest2
* ·½·¨ÃèÊö£º This method is testing the empty username
and the error password
* The end is Loginfailed ,I will print some
error information on the console and
* the page still stay on the login page
* ´´½¨ÈË£ºzzx
* ´´½¨Ê±¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* ÐÞ¸ÄÈË£ºzzx
* ÐÞ¸Äʱ¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* Ð޸ı¸×¢£º
* @version 1.0
* @throws Exception maybe some exception will
happen
*/
//¿ÕµÄÓû§ÃûºÍ´íÎóµÄÃÜÂ룬µÇ¼ʧ°Ü£¬¿ØÖÆÌ¨Êä³ö¡°Óû§Ãû´íÎ󣡡±
@Test(priority=2)
public void loginTest2() throws Exception{
if(!loginPage.isLoginPage(driver)){
driver.get(LoginURL);
}
try {
loginPage.login(driver, "","$z58dSH");
} catch (Exception e) {
System.out.println(e);
}
finally {
assertEquals(false, loginPage.loginStatus(driver));
}
}
/**
* ·½·¨Ãû³Æ£ºloginTest3
* ·½·¨ÃèÊö£º This method is testing the right username
and the empty password
* The end is Loginfailed ,I will print some
error information on the console and
* the page still stay on the login page
* ´´½¨ÈË£ºzzx
* ´´½¨Ê±¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* ÐÞ¸ÄÈË£ºzzx
* ÐÞ¸Äʱ¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* Ð޸ı¸×¢£º
* @version 1.0
* @throws Exception maybe some exception will
happen
*/
//ÕýÈ·Óû§ÃûºÍ¿ÕµÄÃÜÂ룬µÇ¼ʧ°Ü£¬¿ØÖÆÌ¨Êä³ö¡°ÃÜÂë²»ÕýÈ·¡±
@Test(priority=3)
public void loginTest3() throws Exception{
if(!loginPage.isLoginPage(driver)){
driver.get(LoginURL);
}
try {
loginPage.login(driver, "admin","");
} catch (Exception e) {
System.out.println(e);
}
finally {
assertEquals(false, loginPage.loginStatus(driver));
}
}
/**
* ·½·¨Ãû³Æ£ºloginTest4
* ·½·¨ÃèÊö£º This method is testing the error username
and the empty password
* The end is Loginfailed ,I will print some
error information on the console and
* the page still stay on the login page
* ´´½¨ÈË£ºzzx
* ´´½¨Ê±¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* ÐÞ¸ÄÈË£ºzzx
* ÐÞ¸Äʱ¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* Ð޸ı¸×¢£º
* @version 1.0
* @throws Exception maybe some exception will
happen
*/
//´íÎóÓû§ÃûºÍ¿ÕµÄÃÜÂ룬µÇ¼ʧ°Ü£¬¿ØÖÆÌ¨Êä³ö¡°Óû§Ãû´íÎ󣡡±
@Test(priority=4)
public void loginTest4() throws Exception{
if(!loginPage.isLoginPage(driver)){
driver.get(LoginURL);
}
try {
loginPage.login(driver, "admim","");
} catch (Exception e) {
System.out.println(e);
}
finally {
assertEquals(false, loginPage.loginStatus(driver));
}
}
/**
* ·½·¨Ãû³Æ£ºloginTest5
* ·½·¨ÃèÊö£º This method is testing the empty username
and the empty password
* The end is Loginfailed ,I will print some
error information on the console and
* the page still stay on the login page
* ´´½¨ÈË£ºzzx
* ´´½¨Ê±¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* ÐÞ¸ÄÈË£ºzzx
* ÐÞ¸Äʱ¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* Ð޸ı¸×¢£º
* @version 1.0
* @throws Exception maybe some exception will
happen
*/
//¿ÕµÄÓû§ÃûºÍ¿ÕµÄÃÜÂ룬µÇ¼ʧ°Ü£¬¿ØÖÆÌ¨Êä³ö¡°Óû§Ãû´íÎ󣡡±
@Test(priority=5)
public void loginTest5() throws Exception{
if(!loginPage.isLoginPage(driver)){
driver.get(LoginURL);
}
try {
loginPage.login(driver, "","");
} catch (Exception e) {
System.out.println(e);
}
finally {
assertEquals(false, loginPage.loginStatus(driver));
}
}
/**
* ·½·¨Ãû³Æ£ºloginTest6
* ·½·¨ÃèÊö£º This method is testing the error username
and the error password
* The end is Loginfailed ,I will print some
error information on the console and
* the page still stay on the login page
* ´´½¨ÈË£ºzzx
* ´´½¨Ê±¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* ÐÞ¸ÄÈË£ºzzx
* ÐÞ¸Äʱ¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* Ð޸ı¸×¢£º
* @version 1.0
* @throws Exception maybe some exception will
happen
*/
//´íÎóÓû§ÃûºÍ´íÎóµÄÃÜÂ룬µÇ¼ʧ°Ü£¬¿ØÖÆÌ¨Êä³ö¡°Óû§Ãû´íÎ󣡡±
@Test(priority=6)
public void loginTest6() throws Exception{
if(!loginPage.isLoginPage(driver)){
driver.get(LoginURL);
}
try {
loginPage.login(driver, "admim","$z58dSH");
} catch (Exception e) {
System.out.println(e);
}
finally {
assertEquals(false, loginPage.loginStatus(driver));
}
}
/**
* ·½·¨Ãû³Æ£ºloginTest7
* ·½·¨ÃèÊö£º This method is testing the right username
and the error password
* The end is Loginfailed ,I will print some
error information on the console and
* the page still stay on the login page
* ´´½¨ÈË£ºzzx
* ´´½¨Ê±¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* ÐÞ¸ÄÈË£ºzzx
* ÐÞ¸Äʱ¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* Ð޸ı¸×¢£º
* @version 1.0
* @throws Exception maybe some exception will
happen
*/
//ÕýÈ·Óû§ÃûºÍ´íÎóµÄÃÜÂ룬µÇ¼ʧ°Ü£¬¿ØÖÆÌ¨Êä³ö¡°ÃÜÂë²»ÕýÈ·¡±
@Test(priority=7)
public void loginTest7() throws Exception{
if(!loginPage.isLoginPage(driver)){
driver.get(LoginURL);
}
try {
loginPage.login(driver, "admin","$z58dSH");
} catch (Exception e) {
System.out.println(e);
}
finally {
assertEquals(false, loginPage.loginStatus(driver));
}
}
/**
* ·½·¨Ãû³Æ£ºloginTest8
* ·½·¨ÃèÊö£º This method is testing the error username
and the right password
* The end is Loginfailed ,I will print some
error information on the console and
* the page still stay on the login page
* ´´½¨ÈË£ºzzx
* ´´½¨Ê±¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* ÐÞ¸ÄÈË£ºzzx
* ÐÞ¸Äʱ¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* Ð޸ı¸×¢£º
* @version 1.0
* @throws Exception maybe some exception will
happen
*/
//´íÎóÓû§ÃûºÍÕýÈ·ÃÜÂ룬µÇ¼ʧ°Ü£¬¿ØÖÆÌ¨Êä³ö¡°Óû§Ãû´íÎ󣡡±
@Test(priority=8)
public void loginTest8() throws Exception{
if(!loginPage.isLoginPage(driver)){
driver.get(LoginURL);
}
try {
loginPage.login(driver, "admim","$z58dSHE");
} catch (Exception e) {
System.out.println(e);
}
finally {
assertEquals(false, loginPage.loginStatus(driver));
}
}
/**
* ·½·¨Ãû³Æ£ºloginTest9
* ·½·¨ÃèÊö£º This method is testing the right username
and the right password
* The end is successed ,I will print some
successed information on the console and
* the page will into the home page
* ´´½¨ÈË£ºzzx
* ´´½¨Ê±¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* ÐÞ¸ÄÈË£ºzzx
* ÐÞ¸Äʱ¼ä£º2017Äê9ÔÂ12ÈÕ ÏÂÎç5:33:27
* Ð޸ı¸×¢£º
* @version 1.0
* @throws Exception maybe some exception will
happen
*/
//ÕýÈ·Óû§ÃûºÍÕýÈ·ÃÜÂ룬µÇ¼³É¹¦£¬¿ØÖÆÌ¨Êä³ö¡°µÇ¼³É¹¦£¡¡±
@Test(priority=9)
public void loginTest9() throws Exception{
if(!loginPage.isLoginPage(driver)){
driver.get(LoginURL);
}
try {
loginPage.login(driver, "admin","$z58dSHE");
} catch (Exception e) {
System.out.println(e);
}
finally {
assertEquals(true, loginPage.loginStatus(driver));
}
}
} |