关键词:
软件测试第二周作业 wordcount
Github地址
https://github.com/mxz96102/word_count
PSP2.1表格
PSP2.1 | PSP 阶段 | 预估耗时 (分钟) | 实际耗时 (分钟) |
---|---|---|---|
Planning | 计划 | 25 | 30 |
· Estimate | · 估计这个任务需要多少时间 | 150 | 252 |
Development | 开发 | ||
· Analysis | · 需求分析 (包括学习新技术) | 20 | 20 |
· Design Spec | · 生成设计文档 | 0 | 0 |
· Design Review | · 设计复审 (和同事审核设计文档) | 0 | 0 |
· Coding Standard | · 代码规范 (为目前的开发制定合适的规范) | 2 | 2 |
· Design | · 具体设计 | 15 | 30 |
· Coding | · 具体编码 | 100 | 150 |
· Code Review | · 代码复审 | 10 | 10 |
· Test | · 测试(自我测试,修改代码,提交修改) | 3 | 60 |
Reporting | 报告 | 30 | 30 |
· Test Report | · 测试报告 | 5 | 5 |
· Size Measurement | · 计算工作量 | 5 | 5 |
· Postmortem & Process Improvement Plan | · 事后总结, 并提出过程改进计划 | 20 | 20 |
合计 | 205 | 312 |
解题思路
分函数实现功能,并实现通过正则表达式来判断词,行,特殊行。
由空格或逗号分割开的都视为单词,且不做单词的有效性校验,例如:thi#,that视为用逗号隔开的2个单词。
自制arg解析,方便命令行指令功能需求。
查阅资料:
http://blog.csdn.net/soszou/article/details/7979060
程序设计实现过程
-
解析参数
设计ArgsParser类
-
针对错误设计函数
error
-
针对文件读写设计函数
getFileContents,fileToWord,findfiles
-
针对复杂功能设计函数
countWord,countLine,sumChar
-
整合功能以及输出
countFile
代码说明
/**
* 把文件内容按行读进ArrayList
* @param filepath String
* @return contents ArrayList<String>
*/
private static ArrayList<String> getFileContents(String filepath)
/**
* 把文件中的词读进Array
* @param filePath String
* @return words String[]
* @throws IOException
*/
private static String[] fileToWord(String filePath)
/**
* 从文件建立禁用词set
* @param banlistFile String
* @return banwordset Set<String>
*/
private static Set<String> buildBanWord(String banlistFile)
/**
* 计算词数 (以 " " and ","分割)
* @param str String
* @param banWords Set<String>
* @return count int
*/
private static int countWord(String str, Set<String> banWords)
/**
* 将args实例化
* @param args String[]
*/
ArgsParser(String[] args)
/**
* 计算各种特殊行的数量
* @param contents String[]
* @return [codeline, nullline, docline] int[]
*/
private static int[] countline(String[] contents)
/**
* 从字符串数组中算总字符数
* @param contents String[]
* @return sum int
*/
private static int sumChar(String[] contents)
/**
* 确认文件是否存在,不存在则建立
* @param filepath String
*/
private static void confirmFile(String filepath)
/**
* 总的count以及out的函数
* @param filepath String
* @param ap ArgsParser
*/
private static void countFile(String filepath, ArgsParser ap, PrintWriter out)
/**
* 按名称寻找文件清单的函数
* @param filepath String
* @return filepathlist String
*/
private static String[] findfiles(String filepath, boolean s)
测试设计过程
测试过程对于每一项功能单独测试,再进行组合测试,确保覆盖了所有可执行的代码,对文件名输入文件和文件夹也作出了测试,总共设计13个测试用例:
wc.exe
wc.exe -a
wc.exe -a ../test/test.c
wc.exe -l ../test/test.c -o out1.txt
wc.exe -w ../test/test.c -o out2.txt
wc.exe -a ../test/test.c -o out3.txt
wc.exe -c ../test/test.c -o out4.txt
wc.exe -l -w -a -c ../test/test.c -o out5.txt
wc.exe -a ../test/ -o out6.txt
wc.exe -a -s ../test/ -o out7.txt
wc.exe -a ../test/*.c -o out8.txt
wc.exe -a ../test/*.c -e ../stop.txt -o out9.txt
wc.exe -l -w -a -c -s ../test/ -e ../stop.txt -o out10.txt
测试结果见项目下bin
out10.txt out3.txt out5.txt out7.txt out9.txt
out1.txt out2.txt out4.txt out6.txt out8.txt result.txt
参考文献链接
软件质量测试第二周wordcount作业(代码片段)
一.github地址https://github.com/WKX121/WC二.PSPPSP表格PSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划 25 25·Estimate·估计这个任务需要多少时间 25 25Development开发300 340·Analysis·需求分析(包括学习新技术)&... 查看详情
软件测试第二周个人作业wordcount程序实现(代码片段)
GitHub地址:https://github.com/Guchencc/WordCount一.PSP表格PSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划 ·Estimate·估计这个任务需要多少时间 300440Development开发 ·Analysis·需求分析(包括学习新技术) 20&n... 查看详情
第二周作业wordcount(代码片段)
https://github.com/HuangDongPeng/WordCount.git1.1 PSPPSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划 30 30·Estimate·估计这个任务需要多少时间 5h 12hDevelopment开发 2h 4h·Analysis·需求分析(包括学习新技 查看详情
第二周个人作业wordcount(代码片段)
一、GitHub地址https://github.com/JasonLiu1105/WordCount二、PSP表格PSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划 20 20·Estimate·估计这个任务需要多少时间 2days 3daysDevelopment开发 1day 1day·Analysis·需求 查看详情
第二周作业wordcount(代码片段)
github项目链接https://github.com/liqia/WordCount1.项目简介对程序设计语言源文件统计字符数、单词数、行数,统计结果以指定格式输出到默认文件中,以及其他扩展功能,并能够快速地处理多个文件。可执行程序命名为:wc.exe,该程序... 查看详情
软件测试第二周作业(代码片段)
一,github地址https://github.com/lc-xie/WordCount二,PSP表格PSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划 25 25·Estimate·估计这个任务需要多少时间 25 25Development开发200 240·Analysis·需求分析(包括学习新... 查看详情
软件测试第二周个人作业--wordcount
1、Github项目地址:https://github.com/SSS-SY/wordcount 2、PSP2.1表格 PSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划 20 15·Estimate·估计这个任务需要多少时间 30 15Development开发 360 605·Analysi 查看详情
wordcount第二周作业
GitHub地址GitHub地址为:https://github.com/Lovegoodstudy/WordCountPSP表格 PSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划2020·Estimate·估计这个任务需要多少时间2020 Development开发1100 ·Analysis·需求分析(包括学习新技术)... 查看详情
软件测试第二周作业wordcounter(代码片段)
Github项目地址WordCounteringithubPSP(PersonalSoftwareProcess)PSP2.1PSP阶段预估耗时实际耗时(分钟)实际耗时(分钟)Planning计划1017Estimate估计这个任务需要多少时间510Development开发545650-Analysis-需求分析(包括学习新技术)120160-DesignSpec-生... 查看详情
软件工程网络15第二周作业-提出问题(代码片段)
提出问题快速通读教材《构建之法》,并参照提问模板,提出5个问题。如何提出有价值的问题?请看这个文章:http://www.cnblogs.com/rocedu/p/5167941.html,以及在互联网时代如何提问题。还有这些要点:-在每个问题后面,请说明哪一... 查看详情
20165306课下作业(第二周)
一、教材代码完成情况测试代码链接此代码作用是求和(1~5306)。二、带包的代码编译运行测试代码链接三、课后习题p161.Person.java2.两个,Person.class和Xiti.class代码链接 查看详情
《实时控制软件》第二周作业
首先制定各个变量名称入闸传感器:sensor_in;出闸传感器:sensor_out;起落杆上升:gan.raise();起落杆下降:gan.down();信号灯:light(1为绿,0为红);通行状态:A0为禁止通行,A1为允许通行;竖着写(在状态中判断事件)C代码片段cur_st... 查看详情
第二周个人作业(代码片段)
1.GitHub地址:https://github.com/YJG1997/wc2.psp表格PSP2.1表格PSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划 60 50·Estimate·估计这个任务需要多少时间 30 20Development开发 60 90·Analysis·需求分析(包括学... 查看详情
《实时控制软件设计》第二周作业
状态分析由题目描述,只有两种不同事件,一个是车辆进入,一个是车辆离开,与之对应的传感器信号,起落杆信号,通行灯信号都是一同变化,因此可以简化成两种复合状态。 代码实现 传感器头文件////Createdbyzhuha... 查看详情
第二周作业
先测试车辆的进入与进出,定义升起和落下的杆,通过杆的状态不同亮的灯也不一样,在判断车辆有无出入。代码主函数:#include"./head.h"#include<iostream>usingnamespacestd;intmain(){ GurdSystemgs; &... 查看详情
软件测试第四周作业wordcount优化(代码片段)
Github地址https://github.com/husterC/WordCountGroupworkPSP表格PSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划 ·Estimate·估计这个任务需要多少时间540 780Development开发 ·Analysis·需求分析(包括学习新技术) 60&... 查看详情
2017-2018-220179202《网络攻防技术》第二周作业(代码片段)
一、黑客信息袁仁广,中国国家信息安全漏洞库特聘专家,北京奥运会特聘信息安全专家,现任腾讯湛泸实验室负责人。其领衔的360漏洞研究实验室被誉为“东半球最强大的白帽子军团”。他在windows系统方面的造诣,在国内应... 查看详情
软件质量与测试第4周小组作业:wordcount优化(代码片段)
软件质量与测试第4周小组作业:WordCount优化一、GitHub地址https://github.com/fusidic/WC二、PSP表格PSP2.1PSP阶段预估耗时(分钟)实际耗时(分钟)Planning计划3020·Estimate·估计这个任务需要多少时间3020Development开发470550·Analysis·需求分析(... 查看详情