From e0258738d3f34431941fcf27133e801c2eae2d30 Mon Sep 17 00:00:00 2001 From: liyang <“liyang@easycorp.ltd”> Date: Tue, 22 Mar 2022 13:38:37 +0800 Subject: [PATCH] add data of test --- test/data/casestep.yaml | 54 +++++++++++++++++++ test/data/testresult.yaml | 97 ++++++++++++++++++++++++++++++++++ test/data/zentao/config.php | 6 ++- test/data/zentao/processor.php | 24 +++++++++ 4 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 test/data/casestep.yaml create mode 100644 test/data/testresult.yaml diff --git a/test/data/casestep.yaml b/test/data/casestep.yaml new file mode 100644 index 0000000000..a74017ebe7 --- /dev/null +++ b/test/data/casestep.yaml @@ -0,0 +1,54 @@ +title: table zt_casestep +desc: "用例步骤" +author: automated export +version: "1.0" +fields: + - field: id + note: "ID" + range: "1-400" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: parent + note: "上级ID" + range: "0" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: case + note: "所属用例ID" + range: "1-400" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: version + note: "用例版本" + range: "1" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: type + note: "用例类型" + range: "step" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: desc + note: "用例步骤" + range: "1-10000" + prefix: "用例步骤描述" + postfix: "" + loop: 0 + format: "" + - field: expect + note: "预期" + range: "1-10000" + prefix: "这是用例预期结果" + postfix: "" + loop: 0 + format: "" diff --git a/test/data/testresult.yaml b/test/data/testresult.yaml new file mode 100644 index 0000000000..014890f463 --- /dev/null +++ b/test/data/testresult.yaml @@ -0,0 +1,97 @@ +title: table zt_testresult +desc: "测试结果" +author: automated export +version: "1.0" +fields: + - field: id + note: "ID" + range: 1-40 + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: run + note: "运行" + range: 1-40 + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: case + note: "用例ID" + range: 1-400 + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: version + note: "用例版本" + range: 1 + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: job + note: "工作" + range: 0 + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: compile + note: "编译" + range: 0 + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: caseResult + note: "测试结果" + range: pass,fail + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: stepResults + note: "步骤结果" + range: "php处理" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: lastRunner + note: "最后执行人" + range: admin + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: date + note: "测试时间" + range: "(M)-(w):60" + type: timestamp + prefix: "" + postfix: "" + loop: 0 + format: "YYYY-MM-DD hh:mm:ss" + - field: duration + note: "持续时间" + range: 0 + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: xml + note: "XMl格式" + range: "" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: deploy + note: "部署" + range: 0 + prefix: "" + postfix: "" + loop: 0 + format: "" diff --git a/test/data/zentao/config.php b/test/data/zentao/config.php index 0540a7df9f..bbea32a3f6 100644 --- a/test/data/zentao/config.php +++ b/test/data/zentao/config.php @@ -26,11 +26,13 @@ $builder->taskmodule = array('rows' => 1800, 'extends' => array('module','task $builder->taskestimate = array('rows' => 600, 'extends' => array('taskestimate')); $builder->taskson = array('rows' => 10, 'extends' => array('task', 'taskson')); $builder->case = array('rows' => 400, 'extends' => array('case')); +$builder->casestep = array('rows' => 400, 'extends' => array('casestep')); $builder->bug = array('rows' => 300, 'extends' => array('bug')); $builder->morebug = array('rows' => 15, 'extends' => array('bug','morebug')); -$builder->testtask = array('rows' => 10, 'extends' => array('testtask')); -$builder->testrun = array('rows' => 40, 'extends' => array('testrun')); +$builder->testtask = array('rows' => 10, 'extends' => array('testtask')); +$builder->testresult = array('rows' => 40, 'extends' => array('testresult')); +$builder->testrun = array('rows' => 40, 'extends' => array('testrun')); $builder->product = array('rows' => 100, 'extends' => array('product')); $builder->productline = array('rows' => 20, 'extends' => array('module', 'productline')); diff --git a/test/data/zentao/processor.php b/test/data/zentao/processor.php index 4ce5b01c1a..8c586f75b5 100644 --- a/test/data/zentao/processor.php +++ b/test/data/zentao/processor.php @@ -47,6 +47,7 @@ class Processor $this->initUpdateKanban(); $this->initStory(); $this->initBug(); + $this->initTest(); $this->dao->commit(); } @@ -157,11 +158,34 @@ class Processor $this->dao->update(TABLE_STORY)->set('`status`')->eq('active')->where('id')->le('20')->exec(); } + /** + * Init Test. + * + * @access private + * @return void + */ private function initBug() { $this->dao->update(TABLE_BUG)->set('`issueKey`')->eq('2:AX-W7K3_L7H_36P3H4le')->where('issueKey')->eq('17')->exec(); } + private function initTest() + { + $testResults = $this->dao->select('*')->from(TABLE_TESTRESULT)->fetchAll(); + + foreach($testResults as $testResult) + { + if($testResult->caseResult == 'fail') + { + $this->dao->update(TABLE_TESTRESULT)->set('`stepResults`')->eq('a:1:{i:'.$testResult->run.';a:2:{s:6:\"result\";s:4:\"fail\";s:4:\"real\";s:0:\"\";}}')->where('id')->eq($testResult->id)->exec(); + } + else + { + $this->dao->update(TABLE_TESTRESULT)->set('`stepResults`')->eq('a:1:{i:'.$testResult->run.';a:2:{s:6:\"result\";s:4:\"pass\";s:4:\"real\";s:0:\"\";}}')->where('id')->eq($testResult->id)->exec(); + } + } + } + /** * Init product plan. *