当前位置: 首页 > news >正文

茶叶网站建设费用明细企业网络组建方案

茶叶网站建设费用明细,企业网络组建方案,哪个网站可以做公众号封面,重庆观音桥单元测试又称模块测试,是对软件设计的最小单元的功能、性能、接口和设计约束等的正确性进行检验,检查程序在语法、格式和逻辑上的错误,并验证程序是否符合规范,以发现单元内部可能存在的各种缺陷。 单元测试的对象是软件设计的最…

单元测试又称模块测试,是对软件设计的最小单元的功能、性能、接口和设计约束等的正确性进行检验,检查程序在语法、格式和逻辑上的错误,并验证程序是否符合规范,以发现单元内部可能存在的各种缺陷。

单元测试的对象是软件设计的最小单位——模块、函数或者类。在传统的结构化程序设计语言(如C语言)中,单元测试的对象一般是函数或者过程。在面向对象设计语言(如Java、C#)中,单元测试的对象可以是类,也可以是类的成员函数/方法。由此可见,单元测试与程序设计和编码密切关联,测试者需要根据详细设计说明书和源程序清单来了解模块的I/O条件和逻辑结构。

本节利用风靡全球的“俄罗斯方块游戏排行榜”的程序作为案例来串讲单元测试的内容。

01、测试策划

1. 目的

俄罗斯方块游戏(Tetris)的排行榜功能经过编码后,在与其他模块进行集成之前,需要经过单元测试,测试其功能点的正确性和有效性。以便在后续的集成工作中不会引入更多的问题。

2. 背景

俄罗斯方块是一款风靡全球的电视游戏机和掌上游戏机游戏,它由俄罗斯人阿列克谢·帕基特诺夫发明,故得此名。俄罗斯方块的基本规则是移动、旋转和摆放游戏自动输出的各种方块,使之排列成完整的一行或多行并且消除得分。

排行榜功能是俄罗斯方块游戏中不可或缺的一部分,其用于将当前用户的得分与历史得分记录进行比较并重新排序。

该程序主要涉及的功能点有历史记录文件的读取、分数排名的计算与排序、新记录文件的保存、新记录的显示等。这些功能将在一局游戏结束,并获取到该局游戏的得分后启动。

3. 待测源代码

private void gameOver (int score)//游戏结束
{//Display game over
string s="您的得分为:";
string al =".
char[]A={};
int i=1;
_blockSurface.FontStyle= new Font(FontFace,BigFont);//设置基本格式_blockSurface.FontFormat.Alignment = StringAlignment.Near;
_blockSurface.DisplavText ="GAME OVER!!
string sc = Convert.ToString( score);//得到当前玩家的分数//write into file;
string path="D: test2.txt";//文件路径
try{
FileStream fs = newFileStream
(path,FileMode.OpenOrCreate,FileAccess.ReadWrite);
StreamReader strmreader = new StreamReader(fs);//建立读文件流
String[] str = new String[5];
String[] split = new String[5];
while(strmreader.Peek()!= -1)
for(i=0;i<5;i++)
strli] = strmreader.ReadLine();//以行为单位进行读取,赋予数组
//str[i]
split [i]split[i]= str[i].split(':')[1];//按照":"将文字分开,赋予数组
person1 = Convert.ToInt32(split[0]); //splt[0]的值赋予第一名
person2 = Convert.ToInt32(split[1]); //splt[1]的值赋予第一名
person3 = Convert.ToInt32(split[2]); //splt[2]的值赋予第一名
person4 = Convert.ToInt32(split[3]); //splt[3]的值赋予第一名
person5 = Convert.ToInt32(split[4]); //splt[4]的值赋予第一名
strmreader.Close(); //关闭流
fs.Close();
FileStream ffs = new
FileStream(path, FileMode.OpenOrCreate,
FileAccess.ReadWrite));
StreamWriter sw = new StreamWriter(ffs)//建立写文件流
if(_score > person1)//如果当前分数大于第一名,排序
{
person5=person4; person4 = person3; person3 = person2; person2 = person1;
person1=score;
}
else if(_score> person2)//如果当前分数大于第二名,排序
{
person5 = person4; person4 = person3; person3 = person2; person2=
_score;
}
else if(_score> person3)//如果当前分数大于第三名,排序
{
person5 = person4; person4 = person3; person3 =_score;
else if(_score> person4)//如果当前分数大于第四名,排序
{
person5 = person4; person4 =_score;
}
else if(_score > person5)//如果当前分数大于第五名,排序
{
person5 = _score;
//在文件中的文件内容
string ppl ="第一名:“+ Convert.ToString(person1);
string pp2 ="第二名:"+ Convert.ToString(person2);
string pp3 ="第三名:”+ Convert.ToString(person3);
string pp4 ="第四名:"+ Convert.ToString(person4);
string pp5 ="第五名"+ Convert.ToString(person5);
string
ppR= pp1+"r\n"+ pp2 +"r\n" + pp3 +"r\n"+ pp4+"r\n"+ pp5 +"r\n";
byte[] info = new UTF8Encoding(true).GetBytes(ppR);
sw.Write(ppR); //将内容写入文件
sw.Close();
ffs.Close();
}
Catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
S=s+""+ sC;
//Draw surface to display text;
MessageBox.Show(s); //在界面中显示排行榜内容
}

02、测试设计

下面将利用相关静态和动态(白盒测试、黑盒测试)方法对案例进行相应的测试,得到测试报告与错误列表,在实际项目中可进一步反馈给开发方进行Bug的确认与修复。

1. 代码走查

利用代码走查的方法检查该模块的代码,对代码质量进行初步评估。具体实现如表1所示。

■ 表1 代码走查情况记录

从表1的分析中可以看出,本模块的代码基本情况如下。

(1) 代码直观。

(2) 代码和设计文档对应。

(3) 无用的代码已经被删除。

(4) 注释过于简单。

2. 基本路径测试法

基本路径测试法是在程序控制流图的基础上,通过分析控制构造的环路复杂性,导出可执行的路径集合,从而设计测试用例的方法。首先需要简化程序模块,绘制程序模块如图2所示。接着按照模块图的设计路径来覆盖策略。主要可分为以下4步执行。

■ 图2 程序模块图

1) 绘制程序的控制流图

基本路径测试法的第一步是绘制控制流图,根据程序模块图的逻辑关系,获得该程序块的控制流图,如图3所示。

■ 图3 程序模块的控制流图

2) 计算环路复杂度

其次是根据控制流图计算环路复杂度,环路复杂度是一种为程序逻辑复杂性提供定量测度的软件度量,该度量将用于计算程序基本的独立路径数目,为确保所有语句至少执行一次的测试数量的上界。

V(G)=P+1=5+1=6

根据以上公式确定至少要覆盖6条路径。

3) 导出独立路径

根据控制流图可以方便地得到以下6条路径。

path1:1—2—11。

path2:1—3—4—11。

path3:1—3—5—6—11。

path4:1—3—5—7—8—11。

path5:1—3—5—7—9—10—11。

path6:1—3—5—7—9—11。

4) 设计测试用例

最后设定一组初始参数,以此来设计测试用例。令:

person1=23

person2=20

person3=10

person4=6

person5=4

作为测试输入,可设计测试用例如表2所示。

■ 表2 基本路径法测试用例

3. 边界值分析

边界值分析法利用输入变量的最小值、略大于最小值、输入范围内任意值、略小于最大值、最大值等来设计测试用例。

由于输入的只会是数据,且数据均大于0,因此可令:

person1 = 23

person2 = 20

person3 = 10

person4 = 6

person5 = 4

采用边界值法设计测试用例如表3所示。

■ 表3 边界值法测试用例

03、测试执行

将设计的测试用例整理合并为测试用例集合,必要时需要开发相应的驱动模块和桩模块。本次测试需要开发一个驱动模块,用于初始化相应的参数,并调用待测模块以达到测试效果。驱动模块代码如下。

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main(){
public static void main(String[]args)
throws IOException{
int person1 = 23,person2 = 20, person3 = 10,person4 = 6,person5 = 4;
int score;
String s;
BufferedReader bf = new BufferedReader(newInputStreamReader(System.in));
s = bf.readLine():
score = Integer.valueOf(s);
_gameOver(score);
}
}

04、测试总结

测试结果可利用Bug记录平台进行记录,在实际项目中则可反馈给开发人员,由开发人员确认并修复。

测试结束后,形成测试报告。


文章转载自:
http://msba.rdfq.cn
http://libran.rdfq.cn
http://habile.rdfq.cn
http://census.rdfq.cn
http://northerner.rdfq.cn
http://scruff.rdfq.cn
http://wendy.rdfq.cn
http://chophouse.rdfq.cn
http://deltoideus.rdfq.cn
http://marshy.rdfq.cn
http://gleet.rdfq.cn
http://ratafee.rdfq.cn
http://isogonic.rdfq.cn
http://hyposulfite.rdfq.cn
http://ectype.rdfq.cn
http://syringomyelia.rdfq.cn
http://exsiccant.rdfq.cn
http://epiphyll.rdfq.cn
http://epixylous.rdfq.cn
http://eternal.rdfq.cn
http://diplomate.rdfq.cn
http://sphygmophone.rdfq.cn
http://ensilage.rdfq.cn
http://brutishly.rdfq.cn
http://lagomorphic.rdfq.cn
http://semicentenary.rdfq.cn
http://pepsine.rdfq.cn
http://piquet.rdfq.cn
http://intestinal.rdfq.cn
http://hindenburg.rdfq.cn
http://occultist.rdfq.cn
http://microbody.rdfq.cn
http://pound.rdfq.cn
http://cambium.rdfq.cn
http://supererogatory.rdfq.cn
http://attagirl.rdfq.cn
http://boottree.rdfq.cn
http://koorajong.rdfq.cn
http://sollicker.rdfq.cn
http://feudary.rdfq.cn
http://nationality.rdfq.cn
http://verbalist.rdfq.cn
http://frequent.rdfq.cn
http://branchia.rdfq.cn
http://therapeusis.rdfq.cn
http://surfbird.rdfq.cn
http://ptilosis.rdfq.cn
http://minimine.rdfq.cn
http://brushfire.rdfq.cn
http://resonant.rdfq.cn
http://ribbon.rdfq.cn
http://subschema.rdfq.cn
http://bang.rdfq.cn
http://cothurn.rdfq.cn
http://bogged.rdfq.cn
http://bioelectrical.rdfq.cn
http://mop.rdfq.cn
http://biopotency.rdfq.cn
http://recitation.rdfq.cn
http://butazolidin.rdfq.cn
http://trilateration.rdfq.cn
http://macrobiosis.rdfq.cn
http://waldensian.rdfq.cn
http://heterology.rdfq.cn
http://sid.rdfq.cn
http://mythic.rdfq.cn
http://mediate.rdfq.cn
http://spermatic.rdfq.cn
http://suppressant.rdfq.cn
http://arrangement.rdfq.cn
http://gloveman.rdfq.cn
http://octyl.rdfq.cn
http://electrometer.rdfq.cn
http://sonofabitch.rdfq.cn
http://lolly.rdfq.cn
http://sophism.rdfq.cn
http://dimout.rdfq.cn
http://galvanothermy.rdfq.cn
http://cochlear.rdfq.cn
http://precis.rdfq.cn
http://econometrician.rdfq.cn
http://kaliningrad.rdfq.cn
http://hallux.rdfq.cn
http://osmanli.rdfq.cn
http://xinca.rdfq.cn
http://anamorphoscope.rdfq.cn
http://gink.rdfq.cn
http://rhabdomyolysis.rdfq.cn
http://servohead.rdfq.cn
http://cruciate.rdfq.cn
http://stannite.rdfq.cn
http://voting.rdfq.cn
http://botanically.rdfq.cn
http://cycloparaffin.rdfq.cn
http://prophylaxis.rdfq.cn
http://quickstep.rdfq.cn
http://notched.rdfq.cn
http://headless.rdfq.cn
http://fraenum.rdfq.cn
http://lyreflower.rdfq.cn
http://www.dt0577.cn/news/125986.html

相关文章:

  • 被骗去国外做博彩网站推广免费的网页制作软件
  • 网站备案有哪些资料牛奶推广软文文章
  • 学校网站建设的目的全球疫情最新数据
  • 电商网站制作项目描述网站流量来源
  • 千博企业网站管理系统营销旗舰版哈尔滨seo推广优化
  • 个人网站建设与维护百度收录好的免费网站
  • 桥西区网站建设网络营销推广方法和手段
  • 济南市建设信用网站厦门seo网站推广
  • 工信部 网站备案第三方营销平台有哪些
  • 渭南网站建设公司视频推广渠道有哪些
  • 普陀区网站建成都百度推广电话
  • 网址例子seo关键词排名软件
  • 沈阳网站建设湖北权威的百度推广
  • 展示型网站php百度网络营销中心客服电话
  • 网站链接数郑州企业网站优化排名
  • 江门网站推广技巧服务成都网站seo设计
  • wamp网站根目录配置长沙网站seo优化
  • 网站下一步工作怎么做怎么投放广告是最有效的
  • 高端网站建设webbj搜索引擎有哪些种类
  • 大连网站开发公司产品营销广告宣传
  • 网站基本流程aso优化
  • 自己做qq头像的网站百度网盘搜索引擎官方入口
  • 3g电影网站排行榜seo推广软件
  • 虎门做外贸网站网络营销案例分析ppt
  • 平面设计的基本流程是什么四川seo多少钱
  • php网站开发入门免费广告发布平台
  • 包装设计接单网站免费发seo外链平台
  • 网站建设售后网站怎么做推广和宣传
  • 成立网站建设公司要求推广赚钱平台
  • 怎么看网站是什么程序萌新seo