znt/module/testreport/test/zen/getgeneratedandlegacybugdata.php

40 lines
2.2 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 testreportZen::getGeneratedAndLegacyBugData();
timeout=0
cid=0
- 步骤1正常情况-返回5个元素的数组 @5
- 步骤2边界值-无bug数据时foundBugs数量为0 @0
- 步骤3边界值-无bug数据时legacyBugs数量为0 @0
- 步骤4按优先级分组统计-优先级1的generated数量为0 @0
- 步骤5边界值-无测试用例bug时byCaseNum为0 @0
- 步骤6按日期分组统计-验证handleGroups[generated]存在 @1
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/testreportzen.unittest.class.php';
// 2. zendata数据准备根据需要配置
zenData('bug')->gen(0);
zenData('build')->gen(0);
zenData('testtask')->gen(0);
// 3. 用户登录(选择合适角色)
su('admin');
// 4. 创建测试实例(变量名与模块名一致)
$testreportTest = new testreportTest();
// 5. 🔴 强制要求必须包含至少5个测试步骤
r(count($testreportTest->getGeneratedAndLegacyBugDataTest(array(1, 2), array(1), '2024-01-01', '2024-01-31', array(1, 2)))) && p() && e('5'); // 步骤1正常情况-返回5个元素的数组
r(count($testreportTest->getGeneratedAndLegacyBugDataTest(array(1, 2), array(1), '2024-01-01', '2024-01-31', array(1, 2))[0])) && p() && e('0'); // 步骤2边界值-无bug数据时foundBugs数量为0
r(count($testreportTest->getGeneratedAndLegacyBugDataTest(array(1, 2), array(1), '2024-01-01', '2024-01-31', array(1, 2))[1])) && p() && e('0'); // 步骤3边界值-无bug数据时legacyBugs数量为0
r($testreportTest->getGeneratedAndLegacyBugDataTest(array(1, 2), array(1), '2024-01-01', '2024-01-31', array(1, 2))[2]['1']['generated']) && p() && e('0'); // 步骤4按优先级分组统计-优先级1的generated数量为0
r($testreportTest->getGeneratedAndLegacyBugDataTest(array(1, 2), array(1), '2024-01-01', '2024-01-31', array(1, 2))[4]) && p() && e('0'); // 步骤5边界值-无测试用例bug时byCaseNum为0
r(isset($testreportTest->getGeneratedAndLegacyBugDataTest(array(1, 2), array(1), '2024-01-01', '2024-01-31', array(1, 2))[3]['generated'])) && p() && e('1'); // 步骤6按日期分组统计-验证handleGroups[generated]存在