1. Description of the problem
After you enter a string of 1-6 English characters or numbers in three text boxes, click OK to submit.
2. Equivalence class Partitioning
Number |
Valid equivalence classes |
Number |
Invalid equivalence class |
1 |
1≤ length ≤6 |
4 |
Length =0 |
5 |
Length ≥7 |
2 |
Character: a-z,a-z,0-9 |
6 |
Characters other than English/numeric |
3 |
Three text boxes are not empty |
7 |
Have one or more empty text boxes |
3. Test Cases
Number |
Box1;box2;box3 |
overriding equivalence classes |
Output |
1 |
abcdef;123456; ABCDEF |
The |
Enter the correct |
2 |
Abcd12;12abcd;abab12 |
The |
Enter the correct |
3 |
1234567;; 654321 |
1,2,4,5,7 |
Box1 length greater than 6,box2 input is empty, box3 input is correct |
4 |
; aaaaaaa;** |
1,2,4,5,6,7 |
Box1 input is empty, box2 length is greater than 6,box3 character is not letter or number |
5 |
;///////;‘‘‘‘ |
1,3,5,6 |
box1,3 characters are not letters or numbers, Box2 length is greater than 6 |
6 |
A ' a ' a '; 777777;yyy |
1,2,3,6 |
Box1 characters are not letters or numbers, box2,3 entered correctly |
7 |
;; JIU |
1,2,4,7 |
box1,2 input is empty, box3 input is correct |
8 |
???; ;d EE |
1,2,4,6,7 |
Box1 characters are not letters or numbers, Box2 input is blank, box3 input is correct |
9 |
**;o; Abcedfc |
1,2,3,5,6 |
Box1 characters are not letters or numbers, Box2 input is correct, box3 length is greater than 6 |
10 |
; ; |
4,7 |
box1,2,3 input is empty |
————————————————
4. Test results
Number |
Results |
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
5. Code
1<%@ page language= "Java"Import= "java.util.*" pageencoding= "Utf-8"%>2<%@ page contenttype= "text/html; Charset=utf-8 "%>3<%@ pageImport= "Java.sql.*"%>4<%5String Path =Request.getcontextpath ();6String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";7%>8 9<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >Ten One A<base href= "<%=basePath%>" > - -<title> Testing </title> the<meta http-equiv= "Pragma" content= "No-cache" > -<meta http-equiv= "Cache-control" content= "No-cache" > -<meta http-equiv= "Expires" content= "0" > -<meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" > +<meta http-equiv= "description" content= "This is my page" > - + A<script> at function judge () { - -var box =NewArray (3); -var str =NewArray ("Input is Empty", "length greater than 6", "character is not letter or number", "input correct"); - for(i=0;i<3;i++){ -var text =document.getElementById (i). value; invar reg =/[^0-9a-za-z]+$/; - if(Text.length = = 0) toBox[i]=0; + Else if(Text.length > 6) -Box[i]=1; the Else if(reg.test (text)) *box[i]=2; $ ElseBox[i] =3;Panax Notoginseng - } the +var out = ""; A for(j=0;j<3;j++){ thevar r =Box[j]; +out+= "First" + (j+1) + "box" +str[r]+ "\ n"; - } $ alert (out); $ } -</script> - the<body> - Wuyi the<center><tr style= "Text-align:center" > Please enter 1-6 English characters or numbers </tr><br><br> -<tr style= "Text-align:center" >Box1: Wu<input type = "text" id= "0" ></tr><br><br> -<tr "Text-align:center" >Box2: About<input type = "Text" id= "1" ></tr><br><br> $<tr "Text-align:center" >Box3: -<input type = "Text" id= "2" ></tr><br><br> -<tr> - A<button type= "button" onclick= "Judge ();" align = "center" > OK </button></tr> +</center> the</body> -Equivalence class Division (II.)