一、GitHub地址为
https://github.com/decadeheart/WcPlus
二、PSP表格
PSP2.1 |
PSP阶段 |
预估耗时 (分钟) |
实际耗时 (分钟) |
Planning |
计划 | 60 | 60 |
· Estimate |
预估 | 60 | 60 |
Development |
开发 | ||
· Analysis |
· 需求分析 (包括学习新技术) | 60 | 50 |
· Design Spec |
· 生成设计文档 | 100 | 100 |
· Design Review |
· 设计复审 (和同事审核设计文档) | 20 | 30 |
· Coding Standard |
· 代码规范 (为目前的开发制定合适的规范) | 30 | 30 |
· Design |
· 具体设计 | 30 | 40 |
· Coding |
· 具体编码 | 150 | 200 |
· Code Review |
· 代码复审 | 30 | 20 |
· Test |
· 测试(自我测试,修改代码,提交修改) | 40 | 60 |
Reporting |
报告 | 30 | 20 |
· Test Report |
· 测试报告 | 150 | 150 |
· Size Measurement |
· 计算工作量 | 30 | 20 |
· Postmortem & Process Improvement Plan |
· 事后总结, 并提出过程改进计划 | 20 | 10 |
合计 | 750 |
82
|
三、模块编写和测试
这次我负责的是输出模块,主要是将排好序的数组输出到指定文件,并在输出之前判定数组中的个数是否达到要求,如果不足100个,会在输出的指定文件
的开头输出文件中单词数量。以下对该模块的设计和测试进行说明。
模块设计
首先在事先设计好的类中定义好相关属性,并通过if和for语句判定和进行相应的输出 通过VS测试脚本
ofstream output("result.txt"); if (output.is_open()) { if (result.size() < 100) { for (auto p = result.begin(); p != result.end()-1; ++p) { output << p->first << " " << p->second << endl; } output << result[result.size() - 1].first << " " << result[result.size() - 1].second; } else { for (auto p = result.begin(); p != result.begin() + 99; ++p) { output << p->first << " " << p->second << endl; } output << result[99].first << " " << result[99].second; } } else { cout<<"打不开文件"; } output.close();
四、测试用例设计
这部分功能可以分成四个部分:正常输出元素为100的数组,大于100个元素的数组,小于100个的数组,打不开指定文件并返回“打不开文件”,因此我们针对这几个不同的功能部分来分别设计测试用例。
测试用例显示如下:
Test Case ID 测试用例编号 | Test Item 测试项(即功能模块或函数) | Test Case Title 测试用例标题 | Test Criticality重要级别 | Pre-condition 预置条件 | Input 输入 | Procedure 操作步骤 | Output 预期结果 | Result 实际结果 | Status 是否通过 | Remark 备注(在此描述使用的测试方法) |
FileNotOpen1 | output.is_open() | FunctionTestSet | High | 文件不能打开 | a 1,b 1,d 2,e 2 | 打不开文件 | 打不开文件 | ok | ||
FileNotOpen2 | output.is_open() | High | 文件不能打开 | a 2,b 2,d 2,e 2 | 打不开文件 | 打不开文件 | ok | |||
FileNotOpen3 | output.is_open() | High | 文件不能打开 | a 2,b 2,d 2,e 3 | 打不开文件 | 打不开文件 | ok | |||
FileNotOpen4 | output.is_open() | High | 文件不能打开 | a 1,b 1,d 2,e 4 | 打不开文件 | 打不开文件 | ok | |||
FileNotOpen5 | output.is_open() | High | 文件不能打开 | a 2,b 2,d 2,e 5 | 打不开文件 | 打不开文件 | ok | |||
OutPutNormal1 | ofstream output("result.txt") | High | 文件可以用记事本打开 | boy 4,q 5,c 8 | 通过不断更改所得到的单词个数,以及单词的词频数,来进行检测 | boy 4,q 5,c 8 | boy 4,q 5,c 8 | ok | ||
OutPutNormal2 | ofstream output("result.txt") | High | 文件可以用记事本打开 | d 3,f 5,g 4 | d 3,f 5,g 4 | d 3,f 5,g 4 | ok | |||
OutPutNormal3 | ofstream output("result.txt") | High | 文件可以用记事本打开 | a 1,b 1,d 2,e 2 | a 1,b 1,d 2,e 2 | a 1,b 1,d 2,e 2 | ok | |||
OutPutNormal4 | ofstream output("result.txt") | High | 文件可以用记事本打开 | a 1,b 1,d 2,e 4 | a 1,b 1,d 2,e 4 | a 1,b 1,d 2,e 4 | ok | |||
OutPutNormal5 | ofstream output("result.txt") | High | 文件可以用记事本打开 | a 2,b 2,d 2,e 2 | a 2,b 2,d 2,e 2 | a 2,b 2,d 2,e 2 | ok | |||
OutPutAbnormal1 | ofstream output("result.txt") | High | 文件可以用记事本打开 | a 2,b 2,d 2,e 3 | a 2,b 2,d 2,e 3 | a 2,b 2,d 2,e 3 | ok | |||
OutPutAbnormal2 | ofstream output("result.txt") | High | 文件可以用记事本打开 | a 2,b 2,d 2,e 5 | a 2,b 2,d 2,e 5 | a 2,b 2,d 2,e 5 | ok | |||
OutPutAbnormal3 | ofstream output("result.txt") | High | 文件可以用记事本打开 | I 4, n 9,c 8,m 5 | I 4, n 9,c 8,m 5 | I 4, n 9,c 8,m 5 | ok | |||
OutPutAbnormal4 | ofstream output("result.txt") | High | 文件可以用记事本打开 | high 1, building 4, world 10 | high 1, building 4, world 10 | high 1, building 4, world 10 | ok | |||
OutPutAbnormal5 | ofstream output("result.txt") | High | 文件可以用记事本打开 | high 1, building 4, world 11 | high 1, building 4, world 11 | high 1, building 4, world 11 | ok | |||
OutPutAbnormal6 | ofstream output("result.txt") | High | 文件可以用记事本打开 | high 1, building 4, world 12 | high 1, building 4, world 12 | high 1, building 4, world 12 | ok | |||
OutPutAbnormal7 | ofstream output("result.txt") | High | 文件可以用记事本打开 | high 1, building 4, world 13 | high 1, building 4, world 13 | high 1, building 4, world 13 | ok | |||
OutPutAbnormal8 | ofstream output("result.txt") | High | 文件可以用记事本打开 | high 1, building 4, world 14 | high 1, building 4, world 14 | high 1, building 4, world 14 | ok | |||
OutPutAbnormal9 | ofstream output("result.txt") | High | 文件可以用记事本打开 | high 1, building 4, world 15 | high 1, building 4, world 15 | high 1, building 4, world 15 | ok | |||
OutPutAbnormal10 | ofstream output("result.txt") | High | 文件可以用记事本打开 | high 1, building 4, world 16 | high 1, building 4, world 16 | high 1, building 4, world 16 | ok |
五、单元测试结果
通过使用VS脚本进行单元测试,测试的文件和结果可以看GitHub,结果是正确的
六、静态代码扫描
七、小组贡献
本次任务我负责输出模块的操作,小组里的其他组员没有懈怠,都付出了自己的努力,我贡献为0.20
八、组内代码分析
小组内的组员对于这次的程序很关心其代码的规范,所以在这个方面大家做的都很好
九、 小结
在此次小组任务中在进行测试用例的时候因为要求平均每人二十个,所以跟组员讨论了一下怎么去把测试结果在这二十个用例中很好的表现出来,对软件测试这门课的有了更深的理解,但还远远不够,要花更多时间去学习。