bug标准及书写规范
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了bug标准及书写规范相关的知识,希望对你有一定的参考价值。
参考技术A bug有效性Bug严重程度、优先级、缺陷类型是否准确;
需求是否明确、前提条件是否满足、输入数据是否正确、操作步骤是否清晰、问题是否必现、log是否齐全,Bug是否唯一性;
避免提交设计如此、操作错误、重复的、已知的Bug;
尽量多提业务逻辑功能、交互测试方面的问题,同时要兼顾边界值、页面显示问题;
bug六要素:
测试环境、前提条件、操作步骤、预期结果、实际结果、恢复方法
测试设备:
提交Bug要表明测试使用的设备、设备操作系统版本、测试环境、网络类型等等。
前提条件
明确指出所提交的Bug是在怎么样的情况下出现的,当所发现Bug前提条件为空时,需要填【无】。
测试步骤
要简明清晰分步骤描述如何复现Bug问题,步骤用序号编排。
要按照自己的操作的实际步骤写清楚每一步是怎么操作的,最后操作到哪个页面或者点击哪个按键。
如在特定情况下发生的问题,还需明确提供以下信息:
1.准确写出连续点击次数,点击时长与上下滑动屏幕时长。
2.对于特定数据产生的问题,提供具体数据。
3.精准描述bug产生的路径后,再描述现象。
特别提醒:测试步骤中的点击要用->符号连接
期望结果
按照测试步骤应当得到的正确结果,按照产品需求的期望清晰准确的填写预期结果。而且结果必须是肯定无疑义,可判定性的结果。
特别提醒:期望结果不要包含测试步骤,要是简单的一个结果
实际结果
按照测试步骤实际出现的错误结果,避免使用“不正常”,“有误”等模糊词汇,需要直接描述实际现象。
特别提醒:期望结果和实际结果要相互对应
复现步骤描述及概率
描述复现步骤中的页面切换为避免出现描述不清晰或者有歧义,需用“->”符号连接
关于复现概率一定要在多次测试的基础之上填写,若必定复现则填写100%,若偶现,请执行多次后统计概率填写。
截图和附件
UI类型:Bug需要上传截图,并且增加相应的红框标识;
功能类型:必要时上传视频文件,上传格式MP4为主;
崩溃类型:bug则需要上传视频和log并且log不得超过10分钟。
特别提醒:
为避免错失偶现bug,测试时应保持开启log,bug尽量都附上log
附件命名需与标题相呼应,必须注明出现bug的时间点
log日志抓取不能超过10分钟
文件名称不能出现怪异冗长
Matlab代码书写规范
文章目录
标识符命名规则
一般变量
变量命名多采用小驼峰命名方式,如下
var serverForYou
循环变量多采用 i , j , k i,j,k i,j,k等前缀形式命名,应避少用非前缀的命名方式,避免与matlab虚数单位重复
for i_population=1:K
常量、全局变量
常量或者全局变量均采用字母大写形式,如
DECISION
矩阵、结构体、元胞变量
矩阵,结构体及元胞变量多采用各类型英文名+"_"+变量实际代表含义名称,如
cell_mother
struct_population
matrix_fish
结构体属性构建及引用方式
构建
% state: optimization state of one generation
state = struct(...
'currentGen', 1,... % current generation number
'evaluateCount', 0,... % number of objective function evaluation
'totalTime', 0,... % total time from the beginning
'firstFrontCount', 0,... % individual number of first front
'frontCount', 0,... % number of front
'avgEvalTime', 0 ... % average evaluation time of objective function (current generation)
);
引用
options.popSize = 100; % populaion size
options.maxGen = 150; % max generation 若此数值小于listbox值max,则不会显示
options.numObj = 2; % number of objectives
options.numVar = 2; % number of design variables
options.numCons = 2; % number of constraints
函数
- 函数命名多采用小写字母+下划线分割形式命名
non_dominant_sort()
- get/set前缀多用来访问对象或者属性用
- compute前缀多用来计算某些量的函数用,如
compute_objectives()
- is前缀多用来判断
isbool()
代码版式
文件表头
样例
%___________________________________________________________________%
% Multi-Objective Grey Wolf Optimizer (MOGWO) %
% Source codes demo version 1.0 %
% %
% Developed in MATLAB R2011b(7.13) %
% %
% Author and programmer: Seyedali Mirjalili %
% %
% e-Mail: ali.mirjalili@gmail.com %
% seyedali.mirjalili@griffithuni.edu.au %
% %
% Homepage: http://www.alimirjalili.com %
% %
% Main paper: %
% %
% S. Mirjalili, S. Saremi, S. M. Mirjalili, L. Coelho, %
% Multi-objective grey wolf optimizer: A novel algorithm for %
% multi-criterion optimization, Expert Systems with Applications,%
% in press, DOI: http://dx.doi.org/10.1016/j.eswa.2015.10.039 % %
% %
%___________________________________________________________________%
函数说明
样例1:
function [ 函数输出参数] = 函数名( 函数输入)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%此处为函数名,如果不是函数文件就取消此行
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%创建人:
%日期:
%修改人:
%日期:
%函数变量及功能的简单描述
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--函数主体
样例2:
function result = nsga2(opt, varargin)
% Function: result = nsga2(opt, varargin)
% Description: The main flowchart of of NSGA-II. Note:
% All objectives must be minimization. If a objective is maximization, the
% objective should be multipled by -1.
%
% Syntax:
% result = nsga2(opt): 'opt' is generated by function nsgaopt().
% result = nsga2(opt, param): 'param' can be any data type, it will be
% pass to the objective function objfun().
%
% Then ,the result structure can be pass to plotnsga to display the
% population: plotnsga(result);
%
% Parameters:
% opt : A structure generated by funciton nsgaopt().
% varargin : Additional parameter will be pass to the objective functions.
% It can be any data type. For example, if you call: nsga2(opt, param),
% then objfun would be called as objfun(x,param), in which, x is the
% design variables vector.
% Return:
% result : A structure contains optimization result.
%
% LSSSSWC, NWPU
% Revision: 1.2 Data: 2011-07-26
%*************************************************************************
样例3:
%NDSort - Do non-dominated sorting by efficient non-dominated sort.
%
% FrontNo = NDSort(F,s) does non-dominated sorting on F, where F is the
% matrix of objective values of a set of individuals, and s is the number
% of individuals to be sorted at least. FrontNo(i) denotes the front
% number of the i-th individual. The individuals have not been sorted are
% assigned a front number of inf.
%
% FrontNo = NDSort(F,C,s) does non-dominated sorting based on constrained
% domination, where C is the matrix of constraint values of the
% individuals. In this case, feasible solutions always dominate
% infeasible solutions, and one infeasible solution dominates another
% infeasible solution if the former has a smaller overall constraint
% violation than the latter.
%
% In particular, s = 1 indicates finding only the first non-dominated
% front, s = size(F,1)/2 indicates sorting only half the population
% (which is often used in the algorithm), and s = inf indicates sorting
% the whole population.
%
% [FrontNo,K] = NDSort(...) also returns the maximum front number besides
% inf.
%
% Example:
% [FrontNo,MaxFNo] = NDSort(PopObj,1)
% [FrontNo,MaxFNo] = NDSort(PopObj,PopCon,inf)
%------------------------------- Reference --------------------------------
% [1] X. Zhang, Y. Tian, R. Cheng, and Y. Jin, An efficient approach to
% nondominated sorting for evolutionary multiobjective optimization, IEEE
% Transactions on Evolutionary Computation, 2015, 19(2): 201-213.
% [2] X. Zhang, Y. Tian, R. Cheng, and Y. Jin, A decision variable
% clustering based evolutionary algorithm for large-scale many-objective
% optimization, IEEE Transactions on Evolutionary Computation, 2018, 22(1):
% 97-112.
%------------------------------- Copyright --------------------------------
% Copyright (c) 2018-2019 BIMK Group. You are free to use the PlatEMO for
% research purposes. All publications which use this platform or any code
% in the platform should acknowledge the use of "PlatEMO" and reference "Ye
% Tian, Ran Cheng, Xingyi Zhang, and Yaochu Jin, PlatEMO: A MATLAB platform
% for evolutionary multi-objective optimization [educational forum], IEEE
% Computational Intelligence Magazine, 2017, 12(4): 73-87".
%--------------------------------------------------------------------------
代码主体
空行
空行起着分割块或段落的作用,块(段落)之间一般留一个或两个空行。
空行使用规则:
逻辑块之间要留空行
%*************************************************************************
% 1. Initialization
%*************************************************************************
numObj = length( pop(1).obj ); % number of objectives
refPoints = opt.refPoints;
refWeight = opt.refWeight; % weight factor of objectives
if(isempty(refWeight))
refWeight = ones(1, numObj);
end
epsilon = opt.refEpsilon;
numRefPoint = size(refPoints, 1);
% Determine the normalized factors
写作文字格式
敏捷开发之道 —— 如果你的团队缺乏统一标准的环境开发语言版本框架以及书写标准,那么即使勤劳努力,不仅会极其耗时而且成果甚微,
敏捷开发之道 —— 如果你的团队缺乏统一标准的环境开发语言版本框架以及书写标准,那么即使勤劳努力,不仅会极其耗时而且成果甚微,