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) Successful registration must prompt " registration is successful, please remember the 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 |
Xxx-xxx |
Use case name |
User Registration |
case description |
Administrator in the case of the user name exists, the password is correct to enter the site of the background management system, in the Background Management system page click on the user registration jump to the User registration page (url url address is http://www.fengt.com/admin/userregister.jsp register successfully, please remember the password " url address http://www.fengt.com/Admin/Login.jsp) |
Use Case Portal |
Open IE, in the Address bar enter the address of the login page to enter the system's login page, the administrator entered the correct user name and password to enter the background of the site management, click on the user registration to enter the registration page. |
Test Cases |
Scene |
Test steps |
Expected results |
Note |
TC1 |
Administrator Login |
Administrator enters the correct user name |
Login successful |
|
TC2 |
Go to the Site Admin for user Registration |
Click User Registration |
Jump to User Registration page |
|
TC3 |
User name Uniqueness Check |
Enter a user name that already exists |
Prompt that the user already exists |
user name cannot be empty, requires 6-10 characters, consisting of letters and numbers, and can only begin with a letter, and Only |
tc4 |
user name Input validation |
Enter a user name that is not canonical: 1 Span style= "font-family: the song Body;" >, abcd123456789 2 3, 1 ABCDEFG |
1 2 3 |
TC5 |
Password Input Verification |
Enter a valid user name and enter a non-canonical password 12345 |
Prompt password format is not correct, please re-enter |
Password at least 6 bits, including letters, numbers, and special symbols such as:! + ~ etc) |
TC6 |
Password Confirmation Validation |
Enter a valid user name with a different password two times |
Prompt for two times the password entered is inconsistent, please re-enter |
|
TC7 |
Mailbox Input Validation |
Enter the non-canonical mailbox format:[email protected] |
Prompt for incorrect mailbox format, please re-enter |
|
TC8 |
Correct input |
Enter user name: zy1057127474 password:zy123456. Confirm Password: zy123456. Email: [email protected] |
Prompt registration is successful, please remember your password |
|
TC9 |
Registration successful |
Click Sign In |
Jump to login Page |
|
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
User Login</title>
<body>
<form action= "validate.jsp" method= "POST" >
<div align= "center" >
User Login<br><br>
User name:<input id= "Zhuo" type= "text" name= "username" ><br><br>
Dense Code:<input id= "WX" type= "text" name= "password" ><br><br>
<input type= "Submit" id= "Zwx" value= "Login">
</div>
</form>
</body>
Add your own information to the database
Insert into user values (' zhengying ', ' 123456 ');
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.ie.InternetExplorerDriver;
Import org.openqa.selenium.support.ui.WebDriverWait;
public class test{
@Test
public void First () {
System.setproperty ("Webdriver.firefox.bin", "E:\ Firefox \firefox.exe");
Open Firefox Browser
Webdriver Driver = new Firefoxdriver ();
// Open the page you want to test
driver.get ("http://localhost:8080/Lab05/login.jsp") ;
// Set the time for the wait to be exceeded ( Span style= "Font-family:verdana;" >100 seconds)
Webdriverwait wait = new webdriverwait (driver, 100);
// Find user name input box, id Zheng, and automatically enter username
webelement txtsearchbox = driver.findelement (By.name ("Zheng")). SendKeys ("zhengying");
// Find the password entry box, id yy and automatically enter password
Webelement txtsearchbox = driver.findelement (By.name ("yy")). SendKeys ("123456");
Locate the login button,ID zy and click it
Webelement btn = driver.findelement (By.id ("Zy")). Click ();
Close Browser
Driver.close ();
}
}
Fourth time assignment