Merge branch 'sprint/autoTest_liumengyi_bug' into 'master'

* Add auto test of bug.

See merge request easycorp/zentaopms!2361
This commit is contained in:
孙广明
2022-03-18 02:53:05 +00:00
4 changed files with 170 additions and 3 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/bug.class.php';
su('admin');
/**
title=测试bugModel->batchUpdate();
cid=1
pid=1
测试批量修改bug1 >> type,codeerror,config;title,BUG1,批量修改bug一
测试批量修改bug2 >> type,config,install;title,BUG2,批量修改bug二
测试批量修改bug3 >> type,install,security;title,BUG3,批量修改bug三
*/
$bugIDList = array('1', '2', '3');
$title = array('1' => '批量修改bug一', '2' => '批量修改bug二', '3' => '批量修改bug三');
$type = array('1' => 'config', '2' => 'install', '3' => 'security');
$bug = new bugTest();
r($bug->batchUpdateObject($bugIDList, $title[$bugIDList[0]], $type[$bugIDList[0]], $bugIDList[0])) && p('0:field,old,new;1:field,old,new') && e('type,codeerror,config;title,BUG1,批量修改bug一'); // 测试批量修改bug1
r($bug->batchUpdateObject($bugIDList, $title[$bugIDList[1]], $type[$bugIDList[1]], $bugIDList[1])) && p('0:field,old,new;1:field,old,new') && e('type,config,install;title,BUG2,批量修改bug二'); // 测试批量修改bug2
r($bug->batchUpdateObject($bugIDList, $title[$bugIDList[2]], $type[$bugIDList[2]], $bugIDList[2])) && p('0:field,old,new;1:field,old,new') && e('type,install,security;title,BUG3,批量修改bug三'); // 测试批量修改bug3
system("./ztest init");
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php'; su('admin');
include dirname(dirname(dirname(__FILE__))) . '/class/bug.class.php';
/**
title=bugModel->update();
cid=1
pid=1
测试更新bug名称 >> title,BUG1,john
测试更新bug类型 >> type,codeerror,config
测试更新bug名称和类型 >> title,john,jack;type,config,install
测试不更改bug名称 >> 没有数据更新
测试不更改bug类型 >> 没有数据更新
*/
$projectIdList = array('1', '2');
$t_uptitle = array('title' => 'john');
$t_uptype = array('type' => 'config');
$t_typetitle = array('title' => 'jack', 'type' => 'install');
$t_untitle = array('title' => 'jack');
$t_untype = array('type' => 'install');
$bug=new bugTest();
r($bug->updateObject($projectIdList[0], $t_uptitle)) && p('0:field,old,new') && e('title,正常bug2,john'); // 测试更新bug名称
r($bug->updateObject($projectIdList[0], $t_uptype)) && p('0:field,old,new') && e('type,codeerror,config'); // 测试更新bug类型
r($bug->updateObject($projectIdList[0], $t_typetitle)) && p('0:field,old,new;1:field,old,new') && e('title,john,jack;type,config,install'); // 测试更新bug名称和类型
r($bug->updateObject($projectIdList[0], $t_untitle)) && p() && e('没有数据更新'); // 测试不更改bug名称
r($bug->updateObject($projectIdList[0], $t_untype)) && p() && e('没有数据更新'); // 测试不更改bug类型
system("./ztest init");