Software Test fourth time job

Source: Internet
Author: User

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)

Background management user Registration function test case

Use case ID Test Cases Use case name System Login
Use case description Administrator must first log in, enter the site management, access to the background management interface can be user registration; User registration must be carried out: Enter the user name, password, password confirmation, mailbox, these 4 items can not be empty, and the format meets the requirements of the case; After successful registration, prompt registration is successful, and jump to the user login page to log in, and finally enter a registered user to login.
Use Case Portal Open Firefox Browser, in the Address bar input (http://www.fengt.com/Admin/UserRegister.jsp), into the background to manage the user registration interface, user registration, after the successful registration, automatically jump to the background user login interface, to login.

Test case ID Scene Test steps Expected results Note

TC1

Administrator Login Enter User Login screen Login successful
TC2 User name registration input--authentication Enter a new user name in the User Name entry box: for example, xingxing123 Successfully entered the user Registration page, the page element is complete, the display is consistent with the design User name can be registered
TC3 User name Input format error--fault tolerance verification Enter a new user name in the User Name entry box: 12356 or 123ABC or [email protected] or no username, etc. Pop-up Hint: User name requires 6-10 characters, consisting of letters and numbers, and can only start with a letter, automatically jump to step TC2 Bad user name format
TC4 User password input--authentication Enter the new password in the Password entry box: 1994ASD!!! Enter the correct password format, the new password can be used
TC5 Bad password input format--fault tolerance verification Enter the new password in the Password entry box: 12345678 or ... or 36ASD

Step out: Password at least 6 bits, including letters, numbers and special symbols such as:! + ~ etc); auto Jump to step TC4

Password Format error
TC6 Password Confirmation--Verification Enter the password again in the Password confirmation box: XINGASD!!! Show password is correct
Scp Password acknowledgement error--fault tolerance verification Enter the password again in the Password confirmation box: xingasd! password inconsistent; auto Jump to step TC6
TC8 Email input--verification In the Mailbox input box, enter: [Email protected] Mailboxes can be used
TC9 Mailbox format input Error--fault tolerance verification In the Mailbox input box, enter: 98706547sas.com, etc. Mailbox inconsistency; auto Jump to step TC8 The user is not correctly entering the mailbox format
TC10 User completed, start registration Click the Register button Step out of the prompt: "Registration successful, please remember the password", and directly to the user login interface User Registration Successful
TC11 User skipped user name, password, password confirmation, one or more of the mailboxes, not registered Direct confirmation of submission

The registration text box cannot be empty; auto jump to step TC2

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. Add Id=li attribute to login interface

<body>
<form action= "validate.jsp" method= "POST" >
<div align= "center" >
User Login <br>
User name: <input type= "text" name= "username" ><br><br>

Secret &nbsp; code: <input type= "text" name= "password" ><br><br>

<input type= "Submit" value= "Login" id= "li" >
</div>
</form>
</body>

2. Adding test tables and testing cases to MySQL database


Use test;

Create Table User
(
Idint auto_increment NOT NULL,
Username varchar (TEN) is not NULL,
Password varchar (ten) is not NULL,
Primary KEY (ID)
);


Insert into user values (1, ' Xing ', ' Xing ');
Insert into user values (2, ' admin ', ' admin ');

3. Test code

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 test{

/*

* Description: Use SELENIUM2 to implement functional automated testing for login functions in use case projects

*/


     @Test
    public void Demo () {
        
        system.setproperty ("Webdriver.firefox.bin", "E:\\firefox\\firefox.exe") ;
  
        //open Firefox
         Webdriver demo = new Firefoxdriver ();


        //Open the page you want to test
        Demo.get ("http://localhost : 8080/jsp_jdbc/login.jsp ");

        //Setting the wait time exceeded (100 seconds)
        webdriverwait wait = new webdriverwait (driver, 100);

        //Find the User Name entry box and automatically enter the user name
         Webelement Txtsearchbox = demo.findelement (by.name ("Li")). SendKeys ("Xing");
        //Find the Password entry box and automatically enter the password
         Webelement Txtsearchbox = demo.findelement (By.name ("PW")). SendKeys ("Xing");


Find the Login button and click it automatically
Webelement btn = demo.findelement (by.id ("Li")). Click ();

Close browser
Demo.close ();

}


}

Software Test fourth time job

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.