第4周小组作业:WordCount优化
stage1:代码编写+单元测试
PSP表格
|
PSP2.1 |
PSP阶段 |
预估耗时(分钟) |
实际耗时(分钟) |
|
Planning |
计划 |
15 |
15 |
|
Estimate |
估计任务需要多少时间 |
25 |
30 |
|
Development |
开发 |
100 |
100 |
|
Analysis |
需求分析 |
20 |
20 |
|
Design Spec |
生成设计文档 |
20 |
15 |
|
Design Review |
设计复审 |
20 |
15 |
|
Coding Standard |
代码规范 |
20 |
15 |
|
Design |
具体设计 |
20 |
25 |
|
Coding |
具体编码 |
60 |
60 |
|
Code Review |
代码复审 |
20 |
30 |
|
Test |
测试 |
60 |
80 |
|
Reporting |
报告 |
80 |
95 |
|
Test Report |
测试报告 |
30 |
50 |
|
Size Measurement |
计算工作量 |
30 |
25 |
|
Postmortem |
总结 |
20 |
20 |
|
合计 |
530 |
560 |
我主要负责将排序后的单词和词频输出到文件。代码实现:

public class Output {
public static void output(ArrayList<Entry<String, Integer>> list, File outputFile) throws IOException{
if(outputFile==null){
outputFile=new File("result.txt");
}
//FileWriter fW=new FileWriter(outputFile,true);
FileWriter fW=new FileWriter(outputFile);
BufferedWriter bw=new BufferedWriter(fW);
bw.close();
}
}

测试用例设计:
|
Test Case ID测试用例编号 |
Test Item 测试项(即功能模块或函数) |
Test Case Title 测试用例标题 |
Test Criticality重要级别 |
Pre-condition预置条件 |
Input 输入 |
Procedure 操作步骤 |
Output预期结果 |
Result实际结果 |
Status是否通过 |
Remark备注(在此描述使用的测试方法) |
|
1-5 |
输出控制模块 |
单词种类<=5,词频<=10 |
H |
无 |
wcPro.exe |
无 |
参数数量错误 |
参数数量错误 |
是 |
黑盒测试 |
|
6-10 |
输出控制模块 |
单词种类<=5,词频不定 |
H |
无 |
wcPro.exe -a test.txt |
无 |
参数数量错误 |
参数数量错误 |
是 |
黑盒测试 |
|
11-15 |
输出控制模块 |
单词种类>=6,词频<=10 |
H |
无 |
wcPro.exe -a |
无 |
参数数量错误 |
参数数量错误 |
是 |
黑盒测试 |
|
16-20 |
输出控制模块 |
单词种类>=6,词频不定 |
H |
无 |
wcPro.exe test.c |
无 |
输入格式错误 |
输入格式错误 |
是 |
黑盒测试 |
单元测试运行结果:

小组贡献:因为编程能力不够,只完成了控制输出的部分,贡献率为0.13.
组员代码评价
选择刘博谦(17070)的代码进行分析

// 词频排序
public static ArrayList<String> sort(HashMap<String, Integer> map) {
// 以Key进行排序
TreeMap treemap = new TreeMap(map);
// 以value进行排序
ArrayList<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>(
treemap.entrySet());
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
public int compare(Map.Entry<String, Integer> o1,
Map.Entry<String, Integer> o2) {
// 降序
return o2.getValue() - o1.getValue();
// 升序 o1.getValue() - o2.getValue())
}
});
ArrayList<String> str = new ArrayList<String>();
int i = 0;
for (Map.Entry<String, Integer> string : list) {
// 排除-与空格
if (!(string.getKey().equals("")) && !(string.getKey().equals("-"))) {
str.add(string.getKey());
str.add(string.getValue().toString());
// 输出前1000个单词
if (i > 1000)
break;
i++;
}
}
return str;
}

刘博谦的代码遵守了《阿里巴巴Java开发手册》第二条的强制规定,代码命名规范,无需改进。
开发规范
阿里巴巴Java开发规范手册
参考资料:
《阿里巴巴JAVA开发手册》
第4周小组作业:WordCount优化的更多相关文章
- HUST软测1504班第4周小组作业成绩:WordCount优化
说明 本次公布的成绩为第四周作业的结果: 第4周小组作业:WordCount优化 博客推荐:本次作业有一位同学完成有创意,推荐优秀博客.(优秀博客不会对成绩带来正面或者负面影响)PS:做任何创新的任务 ...
- HUST软测1504班第6周小组作业成绩
说明 本次公布的成绩为第6周小组作业的结果: 第6周小组作业:WordCount(详情见毕博平台) 如果同学对作业结果存在异议,可以: 在毕博平台讨论区的第6周作业第在线答疑区发帖申诉. 或直接在博客 ...
- 软件测试第4周小组作业:WordCount优化
一.基本任务:代码编写+单元测试 1.Github地址: https://github.com/Wegnery/New_WordCount 2.PSP2.1表格 PSP2.1 PSP阶段 预估耗时 ( ...
- 第四周小组作业:Wordcount优化
1.小组github地址 https://github.com/muzhailong/wcPro 2.PSP表格 PSP2.1 PSP阶段 预计耗时(分钟) 实际耗时(分钟) Planning 计划 ...
- WordCount优化-第四周小组作业
一.基本功能 GITHUB项目地址:https://github.com/LongtermPartner/ExtendWordCount PSP表格填写: PSP2.1 PSP阶段 预估耗时 (分钟) ...
- 软件质量与测试--第二周作业 WordCount
github地址: https://github.com/wzfhuster/software_test_tasks psp表格: PSP2.1 PSP 阶段 预估耗时 (分钟) 实际耗时 (分钟) ...
- WcPro项目(WordCount优化)
1 基本任务:代码编写+单元测试 1.1 项目GitHub地址 https://github.com/ReWr1te/WcPro 1.2 项目PSP表格 PSP2.1 PSP阶段 预估耗时(分钟) 实 ...
- WordCount优化
Github 地址:chaosrings/wcPro 1.PSP2.1表格 psp 2.1 psp阶段 预估耗时(分钟) 实际耗时(分钟) Planning 计划 10 10 Estimate 估计这 ...
- cousera 深度学习 吴恩达 第一课 第二周 学习率对优化结果的影响
本文代码实验地址: https://github.com/guojun007/logistic_regression_learning_rate cousera 上的作业是 编写一个 logistic ...
随机推荐
- hbase-hive整合及sqoop的安装配置使用
从hbase中拿数据,然后整合到hbase中 上hive官网 -- 点击wiki--> hive hbase integation(整合) --> 注意整合的时候两个软件的版本要能进行整 ...
- Nginx+Keepalived(二)
Linux CentOS7安装Nginx 1.gcc 安装 安装 nginx 需要先将官网下载的源码进行编译,编译依赖 gcc 环境. yum install gcc-c++ 2.PCRE pcre- ...
- Jenkins master slave设置遇到的坑以及解决办法
写好了selenium测试脚本,本地运行没问题,但是现在流行分布式运行,并行执行以显得高大上. 然而,装高大上是要付出代价的. Selenium Grid 已经完美实现分布式和并行了. 奈何现在会Je ...
- PHP : MySQLi【面向过程】操作数据库【 连接、建库、建表、增、删、改、查、关闭】
<?php /** *数据库操作关键函数 *mysql_connect:连接数据 *mysql_error:最后一次sql动作错误信息 *mysqli_query:执行sql语句,增删该查 *m ...
- Linux - 常用 Linux 命令的基本使用
常用 Linux 命令的基本使用 目标 理解学习 Linux 终端命令的原因 常用 Linux 命令体验 01. 学习 Linux 终端命令的原因 Linux 刚面世时并没有图形界面,所有的操作全靠命 ...
- Flipping an Image
Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resu ...
- Java对象回收流程
一.可回收对象判断 引用计数器算法:为对象放置一个引用计数器,当对象被引用时则计数器加一,如果一个对象的计数器标识为零的时候,则表明该对象可被回收.这种方法比较简单,但无法解决对象之间互相引用的情况. ...
- Exp5 MSF基础应用 20165110
Exp5 MSF基础应用 20165110 一.实践要求(3.5分) 实践目标是掌握metasploit的基本应用方式,重点常用的三种攻击方式的思路.具体需要完成: 1.一个主动攻击实践;(1分) m ...
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- python note 16 re模块的使用
1.re模块(#regex) # 查找 # findall : 匹配所有 每一项都是列表中的一个元素 import re ret = re.findall('\d+','dawdawd154wadwa ...