Test of software test four black box testing

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)

User Registration test Case

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 an IDthat already exists:test123

Prompt user already exists, re-enter

SCS

User Directory Entry _ validation

Input z12345

Input success

TC5

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:

zch33+, enter invalid password for the second time: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: z12345 password: zch33+ Confirm password: zch33+ 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

Step one: Give experiment 5 The original login page form code plus ID attribute

User Login </title>

<body>

<form action= "validate.jsp" method= "POST" >

<div align= "center" >

User Login <br>

User name:<input id= "un" type= "text" name= "username" ><br><br>

Password:<input id= "PW" type= "text" name= "password" ><br><br>

<input type= "Submit" id= "SM" value= " login " >

</div>

</form>

</body>

Step Two: Add your own account data to the database

ALTER TABLE user;

Insert into user values (8, ' zch, ' 033 ');

Step Three: Test program 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.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

    */

@Test

public void Demo () {

System.setproperty ("Webdriver.firefox.bin", "D:\\Program Files\\fire\\firefox.exe");

Open Firefox Browser

Webdriver demo = new Firefoxdriver ();

Open the page you want to test

Demo.get ("http://localhost:8080/Lab05/login.jsp");

set the wait time to exceed (90 seconds)

webdriverwait wait = new webdriverwait (driver, 90);

Locate the User Name entry box,ID is un, and enter the user name automatically

Webelement Txtsearchbox = demo.findelement (By.name ("un")). SendKeys ("Zch");

Locate the Password entry box,ID pw, and enter the password automatically

Webelement Txtsearchbox = demo.findelement (By.name ("PW")). SendKeys ("0123456");

Locate the login button,ID is sm, and click it automatically

Webelement btn = demo.findelement (by.id ("su")). Click ();

Close Browser

Demo.close ();

}

}

Test of software test four black box testing

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.