/** * @param TestStepResult $testStepResult The test results of this step * @param UrlGenerator $urlGenerator For video frame URL generation for this tep * @param TestPaths $nameOnlyPaths To get the name of the video dir for this step * @return array Array with the additional information about this step */ private function getAdditionalInfoArray($testStepResult, $urlGenerator, $nameOnlyPaths) { $ret = array(); $progress = $testStepResult->getVisualProgress(); if (array_key_exists('frames', $progress) && is_array($progress['frames']) && count($progress['frames'])) { $ret['videoFrames'] = array(); foreach ($progress['frames'] as $ms => $frame) { $videoFrame = array('time' => $ms); $videoFrame['image'] = $urlGenerator->getFile($frame['file'], $nameOnlyPaths->videoDir()); $videoFrame['VisuallyComplete'] = $frame['progress']; $ret['videoFrames'][] = $videoFrame; } } $requests = $testStepResult->getRequests(); $ret['domains'] = $testStepResult->getDomainBreakdown(); $ret['breakdown'] = $testStepResult->getMimeTypeBreakdown(); // add requests if (!$this->hasInfoFlag(self::WITHOUT_REQUESTS)) { $ret['requests'] = $requests; } // Check to see if we're adding the console log if (!$this->hasInfoFlag(self::WITHOUT_CONSOLE)) { $console_log = $testStepResult->getConsoleLog(); if (isset($console_log)) { $ret['consoleLog'] = $console_log; } } $statusMessages = $testStepResult->getStatusMessages(); if ($statusMessages) { $ret['status'] = $statusMessages; return $ret; } return $ret; }
/** * Print a breakdown of the requests and bytes by domain * @param TestStepResult $testResult Result data of affected run */ private function printDomainBreakdown($testResult) { if (!$this->shouldPrintInfo(self::INFO_DOMAIN_BREAKDOWN)) { return; } echo "<domains>\n"; $breakdown = $testResult->getDomainBreakdown(); foreach ($breakdown as $domain => &$values) { echo "<domain host=\"" . xml_entities($domain) . "\">\n"; echo "<requests>{$values['requests']}</requests>\n"; echo "<bytes>{$values['bytes']}</bytes>\n"; echo "<connections>{$values['connections']}</connections>\n"; if (isset($values['cdn_provider'])) { echo "<cdn_provider>{$values['cdn_provider']}</cdn_provider>\n"; } echo "</domain>\n"; } echo "</domains>\n"; }