Ejemplo n.º 1
0
 /**
  * Constructs a new TestRunResults object by loading the results from the file system
  * @param TestInfo $testInfo Associated test info
  * @param int $runNumber The run number
  * @param bool $isCached False for first view, true for repeat view (cached)
  * @param FileHandler $fileHandler The FileHandler to use
  * @param array $options Options for loading the TestStepData
  * @return TestRunResults|null The initialized object or null if it failed
  */
 public static function fromFiles($testInfo, $runNumber, $isCached, $fileHandler = null, $options = null)
 {
     $stepResults = array();
     $isValid = false;
     for ($stepNumber = 1; $stepNumber <= $testInfo->stepsInRun($runNumber); $stepNumber++) {
         $stepResult = TestStepResult::fromFiles($testInfo, $runNumber, $isCached, $stepNumber, $fileHandler, $options);
         $stepResults[] = $stepResult;
         $isValid = $isValid || $stepResult !== null;
     }
     return $isValid ? new self($testInfo, $runNumber, $isCached, $stepResults) : null;
 }
Ejemplo n.º 2
0
 public function testFromFiles()
 {
     $testInfo = TestInfo::fromFiles($this->resultDir);
     $firstStep = TestStepResult::fromFiles($testInfo, 1, false, 1);
     $this->assertEquals("google", $firstStep->getEventName());
     $this->assertTrue($firstStep->hasCustomEventName());
     $this->assertNotEmpty($firstStep->getRawResults());
     $this->assertEquals("http://google.com", $firstStep->getUrl());
     $this->assertEquals("google", $firstStep->readableIdentifier());
     $secondStep = TestStepResult::fromFiles($testInfo, 1, true, 2);
     $this->assertEquals("Step 2", $secondStep->getEventName());
     $this->assertFalse($secondStep->hasCustomEventName());
     $this->assertNotEmpty($secondStep->getRawResults());
     $this->assertEquals("http://duckduckgo.com", $secondStep->getUrl());
     $this->assertEquals("http://duckduckgo.com", $secondStep->readableIdentifier());
 }
Ejemplo n.º 3
0
 }
 $testInfo = parse_ini_file("./{$test['path']}/testinfo.ini", true);
 if ($testInfo !== FALSE) {
     if (array_key_exists('test', $testInfo) && array_key_exists('location', $testInfo['test'])) {
         $test['location'] = $testInfo['test']['location'];
     }
     if (isset($testInfo['test']) && isset($testInfo['test']['completeTime'])) {
         $test['done'] = true;
         $testInfoObject = TestInfo::fromFiles("./" . $test['path']);
         if (!array_key_exists('run', $test) || !$test['run']) {
             $testResults = TestResults::fromFiles($testInfoObject);
             $test['run'] = $testResults->getMedianRunNumber($test_median_metric, $test['cached']);
             $runResults = $testResults->getRunResult($test['run'], $test['cached']);
             $stepResult = $runResults->getStepResult($test['step']);
         } else {
             $stepResult = TestStepResult::fromFiles($testInfoObject, $test['run'], $test['cached'], $test['step']);
         }
         $test['stepResult'] = $stepResult;
         $test['aft'] = (int) $stepResult->getMetric('aft');
         $loadTime = $stepResult->getMetric('fullyLoaded');
         if (isset($loadTime) && (!isset($fastest) || $loadTime < $fastest)) {
             $fastest = $loadTime;
         }
         // figure out the real end time (in ms)
         if (isset($test['end'])) {
             $visualComplete = $stepResult->getMetric("visualComplte");
             if (!strcmp($test['end'], 'visual') && $visualComplete !== null) {
                 $test['end'] = $visualComplete;
             } elseif (!strcmp($test['end'], 'load')) {
                 $test['end'] = $stepResult->getMetric('loadTime');
             } elseif (!strcmp($test['end'], 'doc')) {
Ejemplo n.º 4
0
 global $testPath, $run, $cached, $step;
 // from common.inc
 $file = $_GET['file'];
 // make sure nobody is trying to use us to pull down external images from somewhere else
 if (strpos($file, ':') === FALSE && strpos($file, '//') === FALSE && strpos($file, '\\') === FALSE) {
     $fileParts = explode('.', $file);
     $parts = pathinfo($file);
     $type = $parts['extension'];
     $fit = max(min(@$_REQUEST['fit'], 1000), 0);
     $newWidth = 250;
     $w = @$_REQUEST['width'];
     if ($w && $w > 20 && $w < 1000) {
         $newWidth = $w;
     }
     $img = null;
     $testStepResult = TestStepResult::fromFiles(TestInfo::fromFiles($testPath), $run, $cached, $step);
     // see if it is a waterfall image
     if (strstr($parts['basename'], 'waterfall') !== false) {
         tbnDrawWaterfall($testStepResult, $img);
     } elseif (strstr($parts['basename'], 'optimization') !== false) {
         tbnDrawChecklist($testStepResult, $img);
     } else {
         if (!is_file("{$testPath}/{$file}")) {
             $file = str_ireplace('.jpg', '.png', $file);
             $parts = pathinfo($file);
             $type = $parts['extension'];
         }
         if (is_file("{$testPath}/{$file}")) {
             if (!strcasecmp($type, 'jpg')) {
                 $img = imagecreatefromjpeg("{$testPath}/{$file}");
             } elseif (!strcasecmp($type, 'gif')) {