WordCount编码与测试
1. github项目地址:https://github.com/wwwwu/WordCount
2.PSP表格:
|
PSP2.1 |
PSP阶段 |
预估耗时 (分钟) |
实际耗时 (分钟) |
|
Planning |
计划 |
10 | - |
|
· Estimate |
· 估计这个任务需要多少时间 |
700 | 800 |
|
Development |
开发 |
600 | 700 |
|
· Analysis |
· 需求分析 (包括学习新技术) |
60 | 50 |
|
· Design Spec |
· 生成设计文档 |
- | - |
|
· Design Review |
· 设计复审 (和同事审核设计文档) |
- | - |
|
· Coding Standard |
· 代码规范 (为目前的开发制定合适的规范) |
- | - |
|
· Design |
· 具体设计 |
10 | 10 |
|
· Coding |
· 具体编码 |
500 | 600 |
|
· Code Review |
· 代码复审 |
- | - |
|
· Test |
· 测试(自我测试,修改代码,提交修改) |
30 | 30 |
|
Reporting |
报告 |
60 | - |
|
· Test Report |
· 测试报告 |
20 | 20 |
|
· Size Measurement |
· 计算工作量 |
- | - |
|
· Postmortem & Process Improvement Plan |
· 事后总结, 并提出过程改进计划 |
10 | 10 |
3. 解题思路:
看到题目要求后,对于基本功能,我首先考虑的是如何统计出字符数、单词数、行数,然后是读取文件、写入文件,最后再考虑参数解析。高级功能也是先思考统计行数的方法,再是递归处理文件和使用停用表。我觉得这个题目涉及到的知识还是很多的,所以也查了很多相关的资料。印象比较深的是参数解析,一开始我不知道args的使用方法,对于参数的输入无从下手,后来问了同学然后在网上搜索后才知道。
部分参考资料:
1. https://www.cnblogs.com/Berryxiong/p/6232373.html 空格分割字符串
2. http://lucien-zzy.iteye.com/blog/2001275 InputStreamReader和BufferedReader用法
3. https://www.cnblogs.com/renxiaoren/p/5220534.html file文件的读取和写入
4. https://www.cnblogs.com/xy-hong/p/7197725.html main函数里String[] args的使用
5. http://blog.csdn.net/sunkun2013/article/details/13167099 把java文件打包成jar文件以及转换成可执行文件exe
4.程序设计实现过程:
程序一共有一个类,三个方法。除了主方法分别是写入文件和读取文件,读取文件方法里包括了统计各种结果的功能。主方法里主要是进行参数解析,也包括停用表和处理同目录文件的功能。
5.代码说明:
注:递归读取同目录下文件参考了周志为同学的代码
参数解析:
int i = 0;
int fc = 0,fo = 0,fw = 0,fl = 0,fs = 0,fe = 0,fa = 0;
//根据输入对有效参数的状态进行处理
while(args[i].equals("-c")||args[i].equals("-w")||args[i].equals("-l")||args[i].equals("-s")||args[i].equals("-a")){
switch(args[i]){
case "-c" :
fc = 1;
i++;
break;
case "-w" :
fw = 1;
i++;
break;
case "-l" :
fl = 1;
i++;
break;
case "-s" :
fs = 1;
i++;
break;
case "-a" :
fa = 1;
i++;
break;
}
}
6.测试设计:
如何设计:应尽可能考虑到所有情况,将有效和可能无效的输入都进行尝试。
可能导致高风险的地方:比如只输入-o或者-e,以及读取的文件为空。
测试代码设计:
(1)-c file.c
(2)-o
(3)-e
(4)-a file.c
(5)-w -a file.c
(6)-l -a file.c -o result.txt
(8)-w file.c -e tt.txt
(7)-c -l -w -a file.c -e tt.txt -o result.txt
(9)-s -c *.c -o result.txt
(10)-c -l -w -a -s *.c -e tt.txt -o result.txt
应该全部覆盖了程序的要求
由于没有控制台,所以对有文件生成的测试结果截图。
读取文件


停用表文件

生成文件

7.参考资料链接:
1. https://www.cnblogs.com/Berryxiong/p/6232373.html 空格分割字符串
2. http://lucien-zzy.iteye.com/blog/2001275 InputStreamReader和BufferedReader用法
3. https://www.cnblogs.com/renxiaoren/p/5220534.html file文件的读取和写入
4. https://www.cnblogs.com/xy-hong/p/7197725.html main函数里String[] args的使用
5. http://blog.csdn.net/sunkun2013/article/details/13167099 把java文件打包成jar文件以及转换成可执行文件exe
6. http://www.cnblogs.com/xinz/archive/2011/10/22/2220872.html PSP表格的填写
7. http://ask.csdn.net/questions/352138 去除停用词
8. https://www.cnblogs.com/ouyangping/p/6842108.html String matches 正则表达
WordCount编码与测试的更多相关文章
- WordCount编码和测试
WordCount编码和测试 项目地址:https://github.com/handsomesnail/WordCount PSP表格 PSP2.1 PSP阶段 预估耗时(分钟) 实际耗时(分钟) ...
- WordCount 编码与测试
word count github 项目地址:https://github.com/liuqiang666/wordCount PSP表格 PSP2.1 PSP阶段 预估耗时(小时) 实际耗时( ...
- 软件质量与测试——WordCount编码实现及测试
1.GitHub地址 https://github.com/noblegongzi/WordCount 2.PSP表格 PSP2.1 PSP 阶段 预估耗时 (分钟) 实际耗时 (分钟) ...
- WordCount编码测试
Github项目地址:https://github.com/LantyrLYL/WordCount PSP表格: PSP2.1 PSP阶段 预估耗时 (分钟) 实际耗时 (分钟) Planning 计 ...
- 软件测试第2周个人作业:WordCount编码测试
一.Github地址 https://github.com/zhouyubei/WordCount 二.PSP表格 PSP2.1 PSP阶段 预估耗时 (分钟) 实际耗时 (分钟) Planning ...
- WordCount程序与测试
Github地址: https://github.com/hcy6668/wordCount PSP表格: PSP PSP阶段 预估耗时(分钟) 实际耗时(分钟) Planning 计划 60 40 ...
- WordCountPro 编码与测试
WordCountPro github项目地址:https://github.com/handsomesnail/WordCountPro PSP表格 PSP2.1 PSP阶段 预估耗时(小时) ...
- WordCount程序及测试
Github地址:https://github.com/CG0317/WordCount PSP表: PSP2.1 PSP阶段 预估耗时 (分钟) 实际耗时 (分钟) Planning 计划 30 ...
- mysql字符集编码乱码测试如下
创建三个表tb_latin1,tb_utf8,tb_gbk,编码分别为latin1/utf8/gbk “你好a”字符串编码如下GBK : %C4%E3 %BA%C3 %61UTF-8 : %E4%BD ...
随机推荐
- DedeCMS织梦模板标签调用大全
本文转载:http://www.mubanzhijia.com/jishujiaocheng/1.html 关键描述调用标签: <meta name="keywords" c ...
- bzoj5457 城市
一棵树,每个点有一个民族,和一个人数,求每个子树里最多的民族及其人数,如果一样,输出编号最小的 $n \leq 500000$ sol: 卡莫队的毒瘤题,需要 dsu on tree 大概就是 dfs ...
- webpack学习(一)—— 入门
,我们通常采用的是组件化开发方式,这样就会对应有很多个js文件,而打包工具的出现则是为了正确处理这些js文件的依赖关系,并生成一个最终的文件,这样,我们最后只需要加载打包以后的文件就可以了,而无须加载 ...
- 获取url参数并且中文不乱码的方法
function getUrlArgument(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...
- C# partial 说明(转)
http://www.cnblogs.com/Echo_saq/archive/2012/11/19/2777058.html 1. 什么是局部类型? C# 2.0 引入了局部类型的概念.局部类型允许 ...
- Maven错误之 Check $M2_HOME environment variable
Eclipse中使用maven插件的时候,运行run as maven build的时候报错 -Dmaven.multiModuleProjectDirectory system propery is ...
- laravel vendor目录的安装
- java的reflection和introspector
JAVA反射机制是在运行状态中,对于任意一个类,都能够得到这个类的所有属性和方法:对于任意一个对象,都能够调用它的任意一个方法:这种动态获取的信息以及动态调用对象的方法的功能称为java语言的反射机制 ...
- SpringBoot自动化配置之四:SpringBoot 之Starter(自动配置)、Command-line runners
Spring Boot Starter是在SpringBoot组件中被提出来的一种概念,stackoverflow上面已经有人概括了这个starter是什么东西,想看完整的回答戳这里 Starter ...
- rem怎么计算
px:相对长度单位.像素px是相对于显示器屏幕分辨率而言的 em:相对单位,继承父节点(层层继承,传递)基准点为父节点字体的大小,如果自身定义了font-size按自身来计算(浏览器默认字体是16px ...