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 )
2, the use of Selenium2 for the Lab05 Project login function to achieve functional automation testing.
Test Cases ID |
Scene |
Test steps |
Results |
TEST1 |
Admin Login |
Go to the login page and log in as an administrator |
Landing success |
TEST2 |
User Registration Login. |
Enter the background management interface, register the user, register the address http://www.fengt.com/Admin/UserRegister.jsp |
To register |
TEST3 |
User name Verification |
Enter a id:test21 that already exists |
Show user already exists |
TEST4 |
The user's famous school test |
Input lxb317 |
Input success |
TEST5 |
Password check |
Enter the correct user name and enter the incorrect password: 5687798 |
Display password is incorrect |
TEST6 |
Mailbox Check |
Enter an incorrect mailbox format: [email protected] |
Display Mailbox Format error |
TEST7 |
Correct input |
Email: [Email protected] |
Successful registration |
TEST8 |
Registration successful |
Page Jump |
Jump to login interface, address http://www.fengt.com/Admin/Login.jsp |
First step: Add ID to the Experiment five login page code
<%@ page contenttype= "text/html; Charset=utf-8 "%>
User Login </title>
<body>
<form action= "validate.jsp" method= "POST" >
<div align= "center" >
User Login <br><br>
User name:<input id= "un" type= "text" name= "username" ><br><br>
Secret code:<input type= "text" name= "password" ><br><br>
<input type= "Submit" value= " login " >
</div>
</form>
</body>
Step Two: Add your own user data to the database
ALTER TABLE user;
Insert into user values (7, ' lxb317 ', ' 31371017 ');
Step three: Test the program
Import Org.junit.Test;
Import Org.openqa.selenium.By;
Import Org.openqa.selenium.WebDriver;
Import org.openqa.selenium.WebElement;
Import Org.openqa.selenium.ie.InternetExplorerDriver;
Import org.openqa.selenium.support.ui.WebDriverWait;
public class seleniumtest{
/ *
* function: Use Selenium2 to be Lab05 function automation test for login function in Project
*LXB
*/
@Test
public void Demo () {
System.setproperty ("Webdriver. Internetexplorer.bin ",
"C:\\Program Files\\ie\\internetexplorer.exe");
Webdriver Driver = new Internetexplorerdriver ();
Driver.get ("http://localhost:8080/Lab05/login.jsp");
webdriverwait wait = new webdriverwait (driver, 15);
Webelement Txtsearchbox = driver.findelement (By.name ("un")). SendKeys ("lxb317");
Webelement Txtsearchbox = driver.findelement (By.name ("PW")). SendKeys ("31371017");
Webelement btn = driver.findelement (By.id ("7"). Click ();
Driver.close ();
}
}
Fourth time assignment