예제 #1
0
 private function getTestRunResultsWithInvalid()
 {
     $step4 = array('result' => 404, 'TTFB' => 500, 'loadTime' => 1000);
     // result is error
     $steps = $this->getTestStepArray();
     $steps[] = TestStepResult::fromPageData($this->testInfo, $step4, 2, false, 4);
     return TestRunResults::fromStepResults($this->testInfo, 2, false, $steps);
 }
예제 #2
0
 private static function singlestepRunFromPageData($testInfo, $runNumber, $cached, &$runs)
 {
     $cacheIdx = $cached ? 1 : 0;
     if (empty($runs[$cacheIdx])) {
         return null;
     }
     $step = TestStepResult::fromPageData($testInfo, $runs[$cacheIdx], $runNumber, $cached, 1);
     return TestRunResults::fromStepResults($testInfo, $runNumber, $cached, array($step));
 }
예제 #3
0
 public function testHasBreakdownTimeline()
 {
     $fileHandlerExists = $this->getMock("FileHandler");
     $fileHandlerExists->method("gzFileExists")->willReturn(true);
     $fileHandlerDoesntExists = $this->getMock("FileHandler");
     $fileHandlerDoesntExists->method("gzFileExists")->willReturn(false);
     $testInfoWithTimeline = TestInfo::fromValues("testId", "/root/path", array("testinfo" => array("timeline" => "1")));
     $testInfoWithoutTimeline = TestInfo::fromValues("testId", "/root/path", array("testinfo" => array()));
     $step = TestStepResult::fromPageData($testInfoWithTimeline, array(), 1, 1, 1, $fileHandlerExists);
     $this->assertTrue($step->hasBreakdownTimeline());
     $step = TestStepResult::fromPageData($testInfoWithTimeline, array(), 1, 1, 1, $fileHandlerDoesntExists);
     $this->assertFalse($step->hasBreakdownTimeline());
     $step = TestStepResult::fromPageData($testInfoWithoutTimeline, array(), 1, 1, 1, $fileHandlerExists);
     $this->assertFalse($step->hasBreakdownTimeline());
     $step = TestStepResult::fromPageData($testInfoWithoutTimeline, array(), 1, 1, 1, $fileHandlerDoesntExists);
     $this->assertFalse($step->hasBreakdownTimeline());
 }
 private function getTestStepArray()
 {
     $step1 = array('result' => 0, 'TTFB' => 300, 'loadTime' => 6000, 'foo' => 'lorem');
     $step2 = array('result' => 0, 'TTFB' => 100, 'loadTime' => 2000, 'foo' => 'ipsum', 'eventName' => "MyEvent");
     $step3 = array('result' => 99999, 'TTFB' => 500, 'loadTime' => 1000, 'foo' => 'dolor');
     $stepResults = array(1 => TestStepResult::fromPageData($this->testInfo, $step1, 2, true, 1), 2 => TestStepResult::fromPageData($this->testInfo, $step2, 2, true, 2), 3 => TestStepResult::fromPageData($this->testInfo, $step3, 2, true, 3));
     return $stepResults;
 }