Equivalent division of software testing two

Source: Internet
Author: User

Last week, the equivalent partition was achieved by the test case, which requires three input boxes at the same time. Actually just increased the number of tests.

This time I'm using Java's program to test.

First, there is no input:

You will be prompted to enter a character that must be 1-6.

Test 1:

Word selector:

121221f

Character Two:

Jjhj12

Word usable:

dsd1&&

The test results are as follows:

Test 2:

Word selector:

1212fd

Character Two:

Fdf123

Word usable:

Adf2d1

Test results:

The Java code is as follows:

Package Ceshi;
Import Java.util.regex.Matcher;
Import Java.util.regex.Pattern;
Import javafx.application.Application;
Import javafx.event.ActionEvent;
Import Javafx.event.EventHandler;
Import Javafx.scene.Scene;
Import Javafx.scene.control.Button;
Import Javafx.scene.control.TextField;
Import Javafx.scene.layout.AnchorPane;
Import Javafx.scene.text.Text;
Import Javafx.stage.Stage;

public class Softceshi extends application{
public static Boolean Isregularrptcode (String rptcode,string regEx) {
Pattern Pat = Pattern.compile (regEx);
Matcher mat = Pat.matcher (Rptcode);
Boolean rs = Mat.matches ();
Return RS;
}
public static void Main (string[] args) {
Softceshi.launch (args);
}
public void start (stage stage) {
Stage.settitle ("Software test Case");
Final Anchorpane Anchorpane = new Anchorpane ();
Stage.setscene (New Scene (Anchorpane, 400, 400));

Text test1= new text ("character one");
Text test2= new text ("Word II");
Text test3= new text ("word usable");

Final TextField []text = new textfield[3];

Text[0] = new TextField ();
TEXT[1] = new TextField ();
TEXT[2] = new TextField ();

Button btn = New button ();
Btn.settext ("submit");

Anchorpane.settopanchor (Test1, 50.0);
Anchorpane.setleftanchor (Test1, 60.0);

Anchorpane.settopanchor (Test2, 100.0);
Anchorpane.setleftanchor (Test2, 60.0);

Anchorpane.settopanchor (Test3, 150.0);
Anchorpane.setleftanchor (Test3, 60.0);

Anchorpane.settopanchor (Text[0], 50.0);
Anchorpane.setleftanchor (Text[0], 120.0);

Anchorpane.settopanchor (text[1], 100.0);
Anchorpane.setleftanchor (text[1], 120.0);

Anchorpane.settopanchor (text[2], 150.0);
Anchorpane.setleftanchor (text[2], 120.0);

Anchorpane.settopanchor (BTN, 150.0);
Anchorpane.setleftanchor (BTN, 300.0);

Btn.setonaction (New eventhandler<actionevent> () {
public void handle (ActionEvent actevt) {
Final String []test = new string[3];
for (int i=0;i<3;i++) {
Test[i] = Text[i].gettext ();
if (Test[i].length () <1| | Test[i].length () >6) {
TextField Text1 = new TextField ("Input length should be 1-6");
Anchorpane.settopanchor (Text1, 200.0+i*50);
Anchorpane.setleftanchor (Text1, 120.0);
Anchorpane.getchildren (). Add (Text1);
}
else if (!isregularrptcode (Test[i], "[a-z,a-z,0-9]*")) {
TextField Text2 = new TextField ("input character should be a-z,a-z,0-9");
Anchorpane.settopanchor (Text2, 200.0+i*50);
Anchorpane.setleftanchor (Text2, 120.0);
Anchorpane.getchildren (). Add (Text2);

}
else{
TextField Text3 = new TextField ("input correct");
Anchorpane.settopanchor (Text3, 200.0+i*50);
Anchorpane.setleftanchor (Text3, 120.0);
Anchorpane.getchildren (). Add (TEXT3);
}
}
}} );

Anchorpane.getchildren (). AddAll (btn,test1,test2,test3,text[0],text[1],text[2]);
Stage.show ();
}
}

Equivalent division of software testing two

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.