摘 要:如何在mantis中增加一些需要统计的字段,导出报表进行统计。
关键词:mantis;自定义段
在使用测试缺陷管理工具mantis时,可能根据实际情况统计一些需要的数据。这就要添加字定义自段,并添加一些代码,导出之后很容易统计。我举个实例来进行操作。假如说要统计BUG错误类型(用户接口、环境、赋值、性能、标准、语法、功能、接口、联编打包、文档)、错误阶段(需求分析、概要设计、详细设计、编码、集成测试、系统测试、交付、维护)。
操作方法如下:
一、 添加自定义段
管理员进入系统----点管理----点自定义段管理,输入字段名“错误阶段”----点新建自定义段。 如下图:
对字段进行设置,(枚举用|隔开)。如下图:
同种方法,可添加错误类型的字段。
二、 把自定义段加入项目中
点管理-点项目管理-选要添加字段的项目进入,找到自定义段项,可增减项目中的自定义字段。如下图:
三、 验证字段是否成功加入项目
点报告问题,查看是否有自定义的字段。如果存在,说明添加成功。如下图:
四、 添加代码(代码来源于网络)
找到Core里面的custom_function_api.php 文件,将以下代码添加进去,添加到末尾的 ?> 前面即可
# --------------------
function custom_function_override_get_columns_to_view( $p_columns_target =
COLUMNS_TARGET_VIEW_PAGE ) {
$t_columns = array();
if ( $p_columns_target == COLUMNS_TARGET_CSV_PAGE ) {
$t_columns[] = 'id'; // localized: 'id',
$t_columns[] = 'project_id'; // 'email_project'
$t_columns[] = 'reporter_id'; // 'reporter'
$t_columns[] = 'handler_id'; // 'assigned_to'
$t_columns[] = 'priority'; // 'priority'
$t_columns[] = 'severity'; // 'severity'
$t_columns[] = 'reproducibility'; // 'reproducibility'
$t_columns[] = 'version'; // 'version'
$t_columns[] = 'projection'; // 'projection'
$t_columns[] = 'category'; // 'category'
$t_columns[] = 'date_submitted'; // 'date_submitted'
$t_columns[] = 'eta'; // 'eta'
$t_columns[] = 'os'; // 'os'
$t_columns[] = 'os_build'; // 'os_version'
$t_columns[] = 'platform'; // 'platform'
$t_columns[] = 'view_state'; // 'view_status'
$t_columns[] = 'last_updated'; // 'last_update'
$t_columns[] = 'summary'; // 'summary'
$t_columns[] = 'status'; // 'status'
$t_columns[] = 'resolution'; // 'resolution'
$t_columns[] = 'fixed_in_version'; // 'fixed_in_version';
# if viewing only one Project, Add all custom fields linked to this project
if ( helper_get_current_project() != ALL_PROJECTS ) {
$t_custom_fields = custom_field_get_linked_ids(helper_get_current_project());
foreach( $t_custom_fields as $t_field_id ) {
$t_desc = custom_field_get_definition( $t_field_id );
$t_columns[] = 'custom_' . $t_desc['name'];
}
}
if ( OFF == config_get( 'enable_relationship' ) ) {
$t_columns[] = 'duplicate_id'; // 'duplicate_id'
}
} else {
$t_columns[] = 'selection';
if ( $p_columns_target == COLUMNS_TARGET_VIEW_PAGE ) {
$t_columns[] = 'edit';
}
$t_columns[] = 'priority';
$t_columns[] = 'id';
$t_enable_sponsorship = config_get( 'enable_sponsorship' );
if ( ON == $t_enable_sponsorship ) {
$t_columns[] = 'sponsorship';
}
$t_columns[] = 'bugnotes_count';
$t_show_attachments= config_get( 'show_attachment_indicator' );
if ( ON == $t_show_attachments ) {
$t_columns[] = 'attachment';
}
$t_columns[] = 'reporter_id';
$t_columns[] = 'category';
$t_columns[] = 'severity';
$t_columns[] = 'status';
$t_columns[] = 'last_updated';
$t_columns[] = 'summary';
}
return $t_columns;
}
五、 导出统计
这个统计是不能在mantis统计里直接出现的,要CVS导出。 如下图:
导进Excel,里面错误类型,错误阶段都很容易统计出来。如下图
版权声明:51Testing软件测试网及相关内容提供者拥有51testing.com内容的全部版权,未经明确的书面许可,任何人或单位不得对本网站内容复制、转载或进行镜像。51testing软件测试网欢迎与业内同行进行有益的合作和交流,如果有任何有关内容方面的合作事宜,请联系我们。