一、程序要求

  EditBox 同时允许输入三个1到6个英文字符或数字,点击确定结束。

二、测试分析

编号 第一个输入框 第二个输入框 第三个输入框 输出
1 null null null 三个输入框均不符合要求
2 abc 123 ab112 三个输入框均符合要求
3 abc.. 123 ab112 第一个输入框不符合要求
4 abc 123.. ab112 第二个输入框不符合要求
5 abc 123 ab112. 第三个输入框不符合要求
6 abcadlsfkja 123 ab112 第一个输入框不符合要求
7 abcadlsfkja 12312192 ab112 只有第三个输入框符合要求
8 abcadlsfkja 12312192 ab112sfav 三个输入框均不符合要求

三、程序代码

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 Equivalence extends Application{ public static void main(String arg0[]){
Equivalence.launch(arg0);
} @Override
public void start(Stage stage) throws Exception {
stage.setTitle("Equivalence class");
AnchorPane root = new AnchorPane(); Text message = new Text("请输入:");
root.getChildren().add(message);
AnchorPane.setTopAnchor(message, 50.0);
AnchorPane.setLeftAnchor(message, 80.0); final TextField textInput1 = new TextField();
root.getChildren().add(textInput1);
AnchorPane.setTopAnchor(textInput1, 70.0);
AnchorPane.setLeftAnchor(textInput1, 33.0); final TextField textInput2 = new TextField();
root.getChildren().add(textInput2);
AnchorPane.setTopAnchor(textInput2, 100.0);
AnchorPane.setLeftAnchor(textInput2, 33.0); final TextField textInput3 = new TextField();
root.getChildren().add(textInput3);
AnchorPane.setTopAnchor(textInput3, 130.0);
AnchorPane.setLeftAnchor(textInput3, 33.0); Button submit = new Button();
submit.setText("确定");
root.getChildren().add(submit);
AnchorPane.setTopAnchor(submit, 170.0);
AnchorPane.setLeftAnchor(submit, 77.0); submit.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent arg0) {
if(checkString(textInput1.getText().toString()) && checkString(textInput2.getText().toString()) && checkString(textInput3.getText().toString())){
Stage newStage = new Stage();
AnchorPane newRoot = new AnchorPane(); Text result = new Text("三个输入框均符合要求~");
newRoot.getChildren().add(result);
AnchorPane.setTopAnchor(result, 20.0);
AnchorPane.setLeftAnchor(result, 30.0); newStage.setScene(new Scene(newRoot, 200, 50));
newStage.show();
}else if(checkString(textInput1.getText().toString()) && checkString(textInput2.getText().toString())){
Stage newStage = new Stage();
AnchorPane newRoot = new AnchorPane(); Text result = new Text("第三个输入框不符合要求~");
newRoot.getChildren().add(result);
AnchorPane.setTopAnchor(result, 20.0);
AnchorPane.setLeftAnchor(result, 30.0); newStage.setScene(new Scene(newRoot, 200, 50));
newStage.show();
}else if(checkString(textInput1.getText().toString()) && checkString(textInput3.getText().toString())){
Stage newStage = new Stage();
AnchorPane newRoot = new AnchorPane(); Text result = new Text("第二个输入框不符合要求~");
newRoot.getChildren().add(result);
AnchorPane.setTopAnchor(result, 20.0);
AnchorPane.setLeftAnchor(result, 30.0); newStage.setScene(new Scene(newRoot, 200, 50));
newStage.show();
}else if(checkString(textInput2.getText().toString()) && checkString(textInput2.getText().toString())){
Stage newStage = new Stage();
AnchorPane newRoot = new AnchorPane(); Text result = new Text("第一个输入框不符合要求~");
newRoot.getChildren().add(result);
AnchorPane.setTopAnchor(result, 20.0);
AnchorPane.setLeftAnchor(result, 30.0); newStage.setScene(new Scene(newRoot, 200, 50));
newStage.show();
}else if(checkString(textInput1.getText().toString())){
Stage newStage = new Stage();
AnchorPane newRoot = new AnchorPane(); Text result = new Text("只有第一个输入框符合要求~");
newRoot.getChildren().add(result);
AnchorPane.setTopAnchor(result, 20.0);
AnchorPane.setLeftAnchor(result, 30.0); newStage.setScene(new Scene(newRoot, 200, 50));
newStage.show();
}else if(checkString(textInput2.getText().toString())){
Stage newStage = new Stage();
AnchorPane newRoot = new AnchorPane(); Text result = new Text("只有第二个输入框符合要求~");
newRoot.getChildren().add(result);
AnchorPane.setTopAnchor(result, 20.0);
AnchorPane.setLeftAnchor(result, 30.0); newStage.setScene(new Scene(newRoot, 200, 50));
newStage.show();
}else if(checkString(textInput3.getText().toString())){
Stage newStage = new Stage();
AnchorPane newRoot = new AnchorPane(); Text result = new Text("只有第三个输入框符合要求~");
newRoot.getChildren().add(result);
AnchorPane.setTopAnchor(result, 20.0);
AnchorPane.setLeftAnchor(result, 30.0); newStage.setScene(new Scene(newRoot, 200, 50));
newStage.show();
}else{
Stage newStage = new Stage();
AnchorPane newRoot = new AnchorPane(); Text result = new Text("三个输入框均不符合要求~");
newRoot.getChildren().add(result);
AnchorPane.setTopAnchor(result, 20.0);
AnchorPane.setLeftAnchor(result, 25.0); newStage.setScene(new Scene(newRoot, 200, 50));
newStage.show();
}
}
}); stage.setScene(new Scene(root, 200,230));
stage.show();
} public boolean checkString(String str){
if(str.length() == 0 || str.length() >= 7){
return false;
} char arr[] = new char[str.length()];
arr = str.toCharArray(); for(int i = 0; i < str.length(); i++){
if((arr[i] >= 'a' && arr[i] <= 'z')||(arr[i] >= 'A' && arr[i] <= 'Z')||(arr[i] >= '0' && arr[i] <= '9'));
else{
return false;
}
}
return true;
} }

四、程序结果

软件测试——等价类划分(EditText * 3)的更多相关文章

  1. 软件测试技术(二)——使用等价类划分的方法进行的UI测试

    测试的目标程序 程序代码 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; impo ...

  2. 等价类划分方法的应用(jsp)

    [问题描述] 在三个文本框中输入字符串,要求均为1到6个英文字符或数字,按submit提交. [划分等价类] 条件1: 字符合法; 条件2: 输入1长度合法; 条件3: 输入2长度合法: 条件4: 输 ...

  3. Java上等价类划分测试的实现

    利用JavaFx实现对有效等价类和无效等价类的划分: 代码: import javafx.application.Application;import javafx.event.ActionEvent ...

  4. 黑盒测试用例设计方法&理论结合实际 -> 等价类划分

    一. 概念 等价类划分法是把程序的输入域划分成若干部分(子集),然后从每个部分中选取少数代表性数据作为测试用例.每一类的代表性数据在测试中的作用等价于这一类中的其他值. 二. 等价类划分的应用 等价类 ...

  5. 计算某天的下一天:黑盒测试之等价类划分+JUnit参数化测试

    题目要求 测试以下程序:该程序有三个输入变量month.day.year(month.day和year均为整数值,并且满足:1≤month≤12.1≤day≤31和1900≤year≤2050),分别 ...

  6. 软件测试技术(三)——使用因果图法进行的UI测试

    目标程序 较上次增加两个相同的输入框 使用方法介绍 因果图法 在Introduction to Software Testing by Paul一书中,将软件测试的覆盖标准划分为四类,logical ...

  7. [liu yanling]软件测试技巧

    1.添加.修改功能 (1)是否支持tab键 (2)是否支持enter键 (3)不符合要求的地方是否有错误提示 (4)保存后,是否也插入到数据库中 (5)字段唯一的,是否可以重复添加 (6)对编辑页列表 ...

  8. [liu yanling]规范软件测试流程

    测试计划 做任何事情都会有输入输出,对于测试过程我们可以把输入理解为测试计划.测试环境准备.测试工具的选择等等,输出可以理解为测试结果.测试用例设计即可以理解为以测试计划为输入的输出,也可以理解为以测 ...

  9. 软件测试software testing summarize

    软件测试(英语:software testing),描述一种用来促进鉴定软件的正确性.完整性.安全性和质量的过程.软件测试的经典定义是:在规定的条件下对程序进行操作,以发现程序错误,衡量软件质量,并对 ...

随机推荐

  1. Observer(观察者)

    意图: 定义对象间的一种一对多的依赖关系,当一个对象的状态发生改变时, 所有依赖于它的对象都得到通知并被自动更新. 适用性: 当一个抽象模型有两个方面, 其中一个方面依赖于另一方面.将这二者封装在独立 ...

  2. 如何以Root权限在Pycharm上Run、Debug

    Pycharm官网提问:https://intellij-support.jetbrains.com/hc/en-us/community/posts/206587695-How-to-run-deb ...

  3. Android之微信开放平台实现分享(分享好友和朋友圈)

    开发中分享操作往往经常遇到,而且还是一些比较大型一定的平台,如微信,QQ,微博等.写这篇博客主要是把微信的的分享和相关操作表达一下,分享可以包含:文字,视频,音乐,图片等分享. 分享可以有 分享给好友 ...

  4. HDU 1045 dfs + 回溯

    题目链接:http://acm.hrbust.edu.cn/vj/index.php?/vj/index.php?c=&c=contest-contest&cid=134#proble ...

  5. easyui combobox 动态加载数组数据

    怕自己忘了,记录下来以后用方便 html部分 <input id="rzcode" name="businesItemId" style="wi ...

  6. [Tomcat无法启动]'Starting Tomcat v8.0 Server at localhost' has encountered a problem.

    运行一个index.jsp,运行提示如下错误:点击服务器 解决办法1: 点击Tomcat服务器,将服务器里的web工程删除掉,再重新运行index.jsp. 解决办法2: 关闭Tomcat,最简单的方 ...

  7. 基于spec评论——王者荣耀交流协会的PSP DAILY作品

    一.运行环境 win10系统. Visual Studio 2017 二.运行程序及截图 1.进入界面如下图. 2.手动输入 类别 任务 点击开始,自动记录时间.如下图. 3.点击结束按钮,会有提示窗 ...

  8. Cobbler自动化安装部署系统

    自动化安装部署 https://www.cnblogs.com/nulige/p/6796593.html PXE+Kickstart工作原理 pxe+kickstart工作流程 网卡上的pxe芯片有 ...

  9. 整理关于Java进行word文档的数据动态数据填充

    首先我们看下,别人整理的关于Java生成doc 的 资料. java生成word的几种方案 1. Jacob是Java-COM Bridge的缩写,它在Java与微软的COM组件之间构建一座桥梁.使用 ...

  10. 无线路由器的加密模式WEP,WPA-PSK(TKIP),WPA2-PSK(AES) WPA-PSK(TKIP)+WPA2-PSK(AES)。

    目前无线路由器里带有的加密模式主要有:WEP,WPA-PSK(TKIP),WPA2-PSK(AES)和WPA-PSK(TKIP)+WPA2-PSK(AES). WEP(有线等效加密)WEP是Wired ...