Пример #1
0
 function testSimpleJobTestResult()
 {
     $test_result_file = dirname(__FILE__) . '/resources/testReport.xml';
     $xmldom = simplexml_load_file($test_result_file);
     $j = new HudsonTestResultTestVersion($this);
     $j->setReturnValue('_getXMLObject', $xmldom);
     $mh = new Mockhudson($this);
     $mh->setReturnValue('getIconsPath', '');
     $j->setReturnValue('getHudsonControler', $mh);
     $j->setReturnValue('getIconsPath', '');
     $j->HudsonTestResult("http://myCIserver/jobs/myCIjob/lastBuild/testReport/");
     $this->assertEqual($j->getFailCount(), 5);
     $this->assertEqual($j->getPassCount(), 416);
     $this->assertEqual($j->getSkipCount(), 3);
     $this->assertEqual($j->getTotalCount(), 424);
 }
Пример #2
0
    function testJobFromMultiConfiguration()
    {
        $xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<matrixProject>
 <displayName>TestProjectMultiConfiguration</displayName>
 <name>TestProjectMultiConfiguration</name>
 <url>http://code4.grenoble.xrce.xerox.com:8080/hudson/job/TestProjectMultiConfiguration/</url>
 <buildable>true</buildable>
 <color>grey</color>
 <inQueue>false</inQueue>
 <keepDependencies>false</keepDependencies>
 <nextBuildNumber>1</nextBuildNumber>
</matrixProject>
XML;
        $xmldom = new SimpleXMLElement($xmlstr);
        $j = new HudsonJobTestVersion($this);
        $j->setReturnValue('_getXMLObject', $xmldom);
        $mh = new Mockhudson($this);
        $mh->setReturnValue('getIconsPath', '');
        $j->setReturnValue('getHudsonControler', $mh);
        $j->setReturnValue('getIconsPath', '');
        $j->__construct("http://myCIserver/jobs/myCIjob");
        $this->assertEqual($j->getProjectStyle(), "matrixProject");
        $this->assertEqual($j->getName(), "TestProjectMultiConfiguration");
        $this->assertEqual($j->getUrl(), "http://code4.grenoble.xrce.xerox.com:8080/hudson/job/TestProjectMultiConfiguration/");
        $this->assertEqual($j->getColor(), "grey");
        $this->assertEqual($j->getStatusIcon(), "status_grey.png");
        $this->assertNull($j->getLastBuildNumber());
        $this->assertNull($j->getLastSuccessfulBuildNumber());
        $this->assertNull($j->getLastFailedBuildNumber());
        $this->assertEqual($j->getNextBuildNumber(), "1");
        $this->assertFalse($j->hasBuilds());
        $this->assertTrue($j->isBuildable());
        $this->assertEqual($j->getHealthScores(), array());
        $this->assertEqual($j->getHealthAverageScore(), '0');
    }