Test cases for software testing------USERFORM1

Source: Internet
Author: User

1. Topic Requirements

2. Implementation methods

I used the Html+servlet method. HTML gives the front-end userform1,servlet processing input in the background and returns the result of the judgment.

Here is the structure of the project and the look of the front end (important code is affixed at the end)

3. Classification of equivalence classes, test cases and experimental results

          Invalid equivalence class for valid equivalence class

Length 1~6 input is empty

Character: a~z,a~z,0~9 input length greater than 6

Contains special characters

From the top, the test case is: 1.ab53c

2. Null input

3.1234avbs

4.%250a

5. Little Brother Bai

Test process and test results such as:

1.ab53c

2. Null input

3.1234avbs

4.%250a

5. Little Brother Bai

4. Results analysis

equivalence class, effective equivalence class, invalid equivalence class can make the testing process simple and effective, and should be used in the test process in the future.  

5. Key code

PrintWriter out =Response.getwriter (); String name= Request.getparameter ("username"); if(Name.length () > 6) {out.println ("<! DOCTYPE HTML public \ "-//W3C//DTD HTML 4.01 transitional//en\" > "); Out.println ("); Out.println ("); Out.println ("<title> Invalid </title>"); Out.println ("); Out.println ("<body>"); Out.println ("); Out.println ("</body>"); Out.println (");        Out.flush (); }Else{            BooleanOK =true;  for(inti = 0;i < Name.length (); i++){                if(Character.getnumericvalue (Name.charat (i)) < 0) {//Determine if the input is Chinese OK=false; Break; }                if(!Character.isletterordigit (Name.charat (i))) {OK=false; Break; }            }if(OK) {out.println ("<! DOCTYPE HTML public \ "-//W3C//DTD HTML 4.01 transitional//en\" > "); Out.println ("); Out.println ("); Out.println ("<title> Effective </title>"); Out.println ("); Out.println ("<body>"); Out.println ("); Out.println ("</body>"); Out.println (");            Out.flush (); }Else{out.println ("<! DOCTYPE HTML public \ "-//W3C//DTD HTML 4.01 transitional//en\" > "); Out.println ("); Out.println ("); Out.println ("<title> Invalid </title>"); Out.println ("); Out.println ("<body>"); Out.println ("); Out.println ("</body>"); Out.println (");            Out.flush (); }                    }

6. Write in the back

Because C1,C2 can not occur simultaneously, there are 24 kinds of cases to consider, when c1,c2 are 0 o'clock, cause and effect

Diagram logic is OK, C1,C2 has a unique when pressing a drink button no problem, press 2 or 3

A button line I think see how the program is written, if the logic of the program is to press Coke, Sprite, black tea

In order to determine whether the button is clicked, the other is or the relationship, so the beverage machine just give a judgment to

First kind of drink.

Test cases for software testing------USERFORM1

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.