软件测试第二周作业 wordcount

软件测试第二周作业 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

解题思路

分函数实现功能,并实现通过正则表达式来判断词,行,特殊行。

自制arg解析,方便命令行指令功能需求。

查阅资料:

https://stackoverflow.com/questions/25555717/intellij-idea-javafx-artifact-build-does-not-generate-exe

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 

参考文献链接

http://www.cnblogs.com/ningjing-zhiyuan/p/8563562.html

原文地址:https://www.cnblogs.com/mxz96102/p/8593917.html

时间: 2024-08-02 02:48:32

软件测试第二周作业 wordcount的相关文章

软件质量与测试第二周作业 WordCount

第二周作业 WordCount 一.Github 地址 https://github.com/llag9810/Software-Quality-and-Testing-Wordcount 二.PSP2.1 表格 PSP2.1 PSP阶段 预估耗时 (分钟) 实际耗时 (分钟) Planning 计划 60 25 · Estimate · 估计这个任务需要多少时间 30 15 Development 开发 600 810 · Analysis · 需求分析 (包括学习新技术) 60 60 · D

第二周作业wordcount

github项目链接https://github.com/liqia/WordCount 1.项目简介 对程序设计语言源文件统计字符数.单词数.行数,统计结果以指定格式输出到默认文件中,以及其他扩展功能,并能够快速地处理多个文件. 可执行程序命名为:wc.exe,该程序处理用户需求的模式为: wc.exe [parameter] [input_file_name] 存储统计结果的文件默认为result.txt,放在与wc.exe相同的目录下. 2.项目psp表格 PSP2.1表格 PSP2.1

软件测试第二周作业

一,github地址 https://github.com/lc-xie/WordCount 二,PSP表格 PSP2.1 PSP阶段 预估耗时 (分钟) 实际耗时 (分钟) Planning 计划  25  25 · Estimate · 估计这个任务需要多少时间  25   25 Development 开发 200  240 · Analysis · 需求分析 (包括学习新技术)  30  30 · Design Spec · 生成设计文档  -  - · Design Review ·

第二周作业 WordCount

https://github.com/HuangDongPeng/WordCount.git 1.1  PSP PSP2.1 PSP阶段 预估耗时 (分钟) 实际耗时 (分钟) Planning 计划 30 30 · Estimate · 估计这个任务需要多少时间 5h 12h Development 开发 2h 4h · Analysis · 需求分析 (包括学习新技术) 30min 30min · Design Spec · 生成设计文档 - - · Design Review · 设计复审

软件测试第二周作业 WordCounter

Github 项目地址 WordCounter in github PSP(Personal Software Process) PSP2.1 PSP阶段 预估耗时实际耗时(分钟) 实际耗时(分钟) Planning 计划 10 17 Estimate 估计这个任务需要多少时间 5 10 Development 开发 545 650 - Analysis - 需求分析(包括学习新技术) 120 160 - Design Spec - 生成设计文档 60 90 - Coding Standard

解题报告——2018级2016第二学期第二周作业

解题报告——2018级2016第二学期第二周作业 D:迷宫问题 题目描述: 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线. 输入 一个5 × 5的二维数组,表示一个迷宫.数据保证有唯一解. 输出 左上角到右

马哥linux 培训第二周作业

注意:第二周作业,请将以下题目整理在51cto博客当中,完成后请将对应的博文链接地址提交在答案栏中,提交格式如下:学号+姓名+博文链接地址eg:1+张三+http://mageedu.blog.51cto.com/4265610/1794420 本周作业内容:1.Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示. 文件管理的命令有cp.mv.rm 复制命令:cp 用法: cp [-adfilprsu] 来源文件(source) 目标文件(destination) cp [o

第二周作业补交(请老师看一下)

#include<stdio.h> #include<math.h> int main(void) { int money,year; double rate,sum; printf("Enter money:"); scanf("%d",&money); printf("Enter year:"); scanf("%d",&year); printf("Enter rate:

魏昊卿——《Linux内核分析》第二周作业:了解操作系统是怎样工作的

魏昊卿——<Linux内核分析>第二周作业:了解操作系统是怎样工作的 一.实验部分 使用实验楼的虚拟机打开shell cd LinuxKernel/linux-3.9.4 qemu -kernel arch/x86/boot/bzImage 然后cd mykernel 您可以看到qemu窗口输出的内容的代码mymain.c和myinterrupt.c 使用自己的Linux系统环境搭建过程参见mykernel,其中也可以找到一个简单的时间片轮转多道程序内核代码 mymain.c myinterr