白盒测试实战——NITIAN Word
来源:互联网 发布:揭秘网络棋牌骗局 编辑:程序博客网 时间:2024/05/22 00:52
最近,我在编写一款自娱自乐的单词对比记忆的软件NITIAN WORD,这里选取它的一部分逻辑,利用白盒方法进行测试,算是理论联系实际吧。
主要逻辑代码:
String wordsArray[] = new String[Global.input_words_ceiling];NTDictionary dict = new NTDictionary();while(!endFlag) {System.out.println("----------------------------------------------------------");System.out.println("please input a group of English words");System.out.println("words separated by a space, and end up with the key Enter");System.out.println("and enter q to quit");sc = new Scanner(System.in);String st = sc.nextLine().trim(); // wipe out the head and the tall spaceif(st.equals("q")) {endFlag = true;System.out.println("you have exit normally");} else if(st.equals("")) {System.out.println("the input should not be empty");} else {//use regular expression to make sure that the string only consists of English charactersPattern pattern = Pattern.compile("^[A-Za-z\\s]+$");Matcher matcher = pattern.matcher(st);boolean isAllEngFlag = matcher.matches();if(isAllEngFlag == true) {wordsArray = st.split("\\s+"); // wipe out more spaces and get each wordint isExist = dict.judgeExistence(wordsArray); //judge whether there is the identical entryif(isExist == 0) {dict.collectWords(wordsArray);//if not exist, collect the entrySystem.out.println("yeah, SUCCESS");} else {System.out.println("there is already entry");System.out.println("the line num is-----> " + isExist);}} else {System.out.println("your input shoud only be composed of English characters");}}
程序流程图:
白盒测试之语句覆盖:
白盒测试之判定覆盖:
测试情况:
总结:
这里语句覆盖和判定覆盖所用的最少测试用例一模一样,这是因为只要执行到一个可执行语句,就意味着结束,所以有多少个执行语句,就有多少个测试用例,从而达到语句覆盖的目的。而在判定覆盖中,只要用例能全部执行到可执行代码实际上就涵盖了所有的分支,同样一个用例只能执行一个可执行语句。所以二者的用例一模一样,证明完毕。
2 0
- 白盒测试实战——NITIAN Word
- 白盒测试技术实战训练
- clojure实战——midje测试框架
- 移动App测试实战——专项测试
- 软件自动化测试——入门、进阶与实战
- Selenium实战——.Net下的自动化测试搭建
- 【Android测试】【第十三节】Uiautomator——项目实战
- 手机开发实战191——手机软件测试1
- 手机开发实战192——手机软件测试2
- 手机开发实战193——手机软件测试3
- 手机开发实战195——CTS认证测试1
- 手机开发实战196——CTS认证测试2
- 手机开发实战197——CTS认证测试3
- 手机开发实战198——GMS认证测试
- 微信开发实战(1)—申请测试号
- Android应用测试与调试实战第3章:Android界面自动化白盒测试
- 基于《Selenium 2自动化测试实战》的学习笔记(1)—— 软件测试分类
- 基于《Selenium 2自动化测试实战》的学习笔记(7)—— 操作测试对象
- goagent proxy.ini 配置介绍
- 有兴趣玩游戏的
- nohup 后台运行,以及重定向标准输出和标准错误 &/dev/null 文件
- wget设置代理
- linux 进程的前后台切换及进程的暂停终止bg,fg,nohup
- 白盒测试实战——NITIAN Word
- C#泛型编程
- Jackson和Gson的使用
- Search a 2D Matrix
- 二维几何模板-与圆有关的计算 _long double 版
- jquery操作select(取值,设置选中)
- UVa 10674 Tangents 求两圆公切线
- Java那些事:泛型
- hdu 1023 Train Problem II_出栈方法数_卡特兰数