1, the background of a company's website management has a user registration function needs to test, the test is a black box test, please use a table to give the function of the test case (refer to the Textbook P107 page). The user registration function is described as follows:
(1) The administrator must first log in, to enter the site management, access to the background management interface can be user registration (assuming that the user registered URL address is http://www.fengt.com/Admin/UserRegister.jsp)
(2) User registration requirements to enter the user name, password, password confirmation, mailbox, these 4 items can not be empty
(3) The user name requires 6-10 characters, consisting of letters and numbers, and can only begin with a letter. The user name is unique.
(4) Password at least 6 digits, including letters, numbers and special symbols (such as:!) + ~ etc)
(5) The mailbox must comply with the mailbox rules
(6) Any requirement above the law should have a corresponding prompt
(7) Registration success must prompt "registration success, please remember password" and jump to the user login page to sign in (assuming the user login page is http://www.fengt.com/Admin/Login.jsp)
Use case ID |
Xxxx-xx-xx |
Use case name |
User Registration |
Use case description |
Admin Login Background interface, registered user name, password, password confirmation and the mailbox are in accordance with the case, the Registration Success page information includes admin login background management page, user name, password, password confirmation and Mailbox entry interface, enter data after the registration Success page, user login page. |
Use Case Portal |
Administrator Login Background Management interface, enter the background login interface for user registration. |
Test case ID |
Scene |
Test steps |
Expected results |
Note |
TC1 |
Admin Login |
Enter the landing page to log in |
Show Admin Login Successful |
|
TC2 |
Go to the Admin interface, Login for user registration. |
Select User Registration module for user registration, browser address http://www.fengt.com/Admin/UserRegister.jsp |
Successfully entered the registration module |
|
TC3 |
User name Verification |
Enter a id:test123 that already exists |
Prompt user already exists, re-enter |
|
TC4 |
User Directory Entry _ validation |
Input l12345 |
Input success |
|
Scr |
User name _ Fault tolerance verification |
Input: 123456789 |
Password does not meet the requirements, please re-enter |
Input data exceeds specified length range |
|
User name _ Fault tolerance verification |
Input: 123 |
Password does not meet the requirements, please re-enter |
Insufficient input data specified length range |
TC6 |
Password verification |
Enter the user name for the specification and enter a compliance Fan's password: 123456 |
Prompted to enter a password that does not conform to the specification, please re-check the input. |
|
TC7 |
Password Confirmation--validity check |
Enter a valid user name and enter the canonical password for the first time: lzh33+, second input invalid password: 123456 |
Prompted to enter the two times the password is not the same, please re-enter |
|
TC8 |
Mailbox Input Validation |
Enter a non-compliant mailbox format: [email protected] |
Prompt to enter the mailbox format is incorrect, please re-enter |
|
TC9 |
Correct input |
Enter user name: l12345 password: lzh33+ Confirm password: lzh33+ email:[email protected], click Submit |
Prompt input correct, registration successful, and prompt "registration successful, please remember password" |
|
TC10 |
Registration successful |
Page Jump |
Jump into landing page http://www.fengt.com/Admin/Login.jsp |
|
2, the use of Selenium2 for the LAB05 project login function to achieve functional automation testing.
Note
L Design test Cases should consider the success of the login and unsuccessful two situations;
L LAB05 Project for the experiment 5 to use the project, in everyone's class QQ group, the database using MySQL, database files in the project root directory CreateDataBase.txt
(1) Start from Eclipse to browser
Package com.lwk.test;
Import Org.junit.Test;
Import Org.openqa.selenium.By;
Import Org.openqa.selenium.WebDriver;
Import org.openqa.selenium.WebElement;
Import Org.openqa.selenium.firefox.FirefoxDriver;
Import org.openqa.selenium.support.ui.WebDriverWait;
public class Test1 {
@Test
public void Test () {
If the browser is not installed by default on the C drive, you need to develop its path
System.setproperty ("Webdriver.firefox.bin", "E:\\program Files\\mozilla firefox\\firefox.exe");
System.setproperty ("Webdriver.ie.driver", "C:\\Program files\\internet Explorer\\iedriverserver.exe");
Open Firefox browser
Webdriver Driver = new Firefoxdriver ();
Open IE browser
/*webdriver Driver = new Internetexplorerdriver (); */
If you do a page test, it is recommended to use Httpunitdriver, this way to open the browser, but in memory run, faster
Webdriver Driver = new Htmlunitdriver ();
Open the page you want to test
Driver.get ("http://www.baidu.com/");
SYSTEM.OUT.PRINTLN ("Open link-up");
Set the wait time to exceed (100 seconds)
webdriverwait wait = new webdriverwait (driver, 100);
Find the page element, here is the search input box
Webelement Txtsearchbox = driver.findelement (By.name ("WD"));
Set the value of the page element, i.e. enter a value into the input box
Txtsearchbox.sendkeys ("selenium2");
Find the Search button and click on it
Webelement btn = driver.findelement (by.id ("su"));
Btn.click ();
Close browser
Driver.close ();
}
}
(2) record first, then turn into Java code
Package com.lwk.test;
Import Java.util.regex.Pattern;
Import Java.util.concurrent.TimeUnit;
Import org.junit.*;
Import static org.junit.assert.*;
Import static org.hamcrest.corematchers.*;
Import org.openqa.selenium.*;
Import Org.openqa.selenium.firefox.FirefoxDriver;
Import Org.openqa.selenium.support.ui.Select;
public class Test2 {
Private Webdriver driver;
Private String BaseUrl;
Private Boolean Acceptnextalert = true;
Private StringBuffer verificationerrors = new StringBuffer ();
@Before
public void SetUp () throws Exception {
System.setproperty ("Webdriver.firefox.bin", "E:\\program Files\\mozilla firefox\\firefox.exe");
Driver = new Firefoxdriver ();
BASEURL = "https://www.baidu.com/";
Driver.manage (). Timeouts (). implicitlywait (Timeunit.seconds);
}
@Test
public void testuntitled () throws Exception {
Driver.get (BaseUrl + "/");
Driver.findelement (By.id ("kw")). Click ();
Driver.findelement (By.id ("kw")). Click ();
Driver.findelement (By.id ("kw")). Click ();
Driver.findelement (By.id ("kw")). Clear ();
Driver.findelement (By.id ("kw")). SendKeys ("Seleniumide");
Driver.findelement (By.id ("su")). Click ();
Driver.findelement (By.id ("kw")). Click ();
}
@After
public void TearDown () throws Exception {
Driver.quit ();
String verificationerrorstring = verificationerrors.tostring ();
if (! "". Equals (verificationerrorstring)) {
Fail (verificationerrorstring);
}
}
Private Boolean iselementpresent (by) {
try {
Driver.findelement (by);
return true;
} catch (Nosuchelementexception e) {
return false;
}
}
Private Boolean isalertpresent () {
try {
Driver.switchto (). alert ();
return true;
} catch (Noalertpresentexception e) {
return false;
}
}
Private String Closealertandgetitstext () {
try {
Alert alert = Driver.switchto (). alert ();
String Alerttext = Alert.gettext ();
if (Acceptnextalert) {
Alert.accept ();
} else {
Alert.dismiss ();
}
return alerttext;
} finally {
Acceptnextalert = true;
}
}
}
Fourth Time Blog Assignment