Skip to content

Commit

Permalink
【autopack测试脚本】
Browse files Browse the repository at this point in the history
更新生成结果文件
  • Loading branch information
wangfangguo01 committed Aug 4, 2014
1 parent deea692 commit 7724b2f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/util/autopack/TestReport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public function createTestReport(){
$data=$this->data;
$totalCount=0;
$totalFailure=0;
$Count = 0;
$Failure = 0;
if(file_exists($xmlFile)){
$dom->load($xmlFile);
$testsuite = $dom->getElementsByTagName("testsuite")->item(0);
Expand All @@ -64,18 +66,22 @@ public function createTestReport(){
$dom->appendChild($testsuite);
}
$name=$data['name'];
if(array_key_exists("success",$data))
$totalCount += count($data['success']);
if(array_key_exists("success",$data)){
$Count = count($data['success']);
$totalCount += $Count;
}
if(array_key_exists("fail",$data)){
$totalFailure += count($data['fail']);
$totalCount += count($data['fail']);
$Failure = count($data['fail']);
$Count += count($data['fail']);
$totalFailure += $Failure;
$totalCount += $Count;
}
$testsuite->setAttribute("name","$name* ");
$testsuite->setAttribute("tests",$totalCount);
$testsuite->setAttribute("time",$totalCount);
$testsuite->setAttribute("failures",$totalFailure);
$testsuite->setAttribute("total",$totalCount);
for($i=$totalFailure;$i<$totalCount;$i++){
for($i=$Failure;$i<$Count;$i++){
$testcase=$dom->createElement("testcase");
$testsuite->appendChild($testcase);
$testcase->setAttribute("name",key($data["success"][$i-$totalFailure]));
Expand All @@ -86,7 +92,7 @@ public function createTestReport(){
$msgText = $dom->createTextNode(current($data["success"][$i-$totalFailure]));
$testcase->appendChild($msgText);
}
for($i=0;$i<$totalFailure;$i++){
for($i=0;$i<$Failure;$i++){
$testcase=$dom->createElement("testcase");
$testsuite->appendChild($testcase);
$testcase->setAttribute("name",key($data["fail"][$i]));
Expand Down

0 comments on commit 7724b2f

Please sign in to comment.