public function setUp() { $this->tempDir = TestUtil::extractToTemp(__DIR__ . '/data/multistepResults.zip'); if (!$this->tempDir) { $this->fail("Failed to extract test data."); } $this->resultDir = $this->tempDir . '/multistepResults'; $this->testId = "160623_K8_3"; }
public function testGetRequests() { global $SINGLESTEP_REQUESTS; $this->tempDir = TestUtil::extractToTemp(__DIR__ . "/data/singlestepResults.zip"); if (!$this->tempDir) { $this->fail("Failed to extract results to temp dir"); } $testPath = $this->tempDir . "/singlestepResults"; $actualRequests = getRequests("testId", $testPath, 1, 0, $hasSecure, $hasLocations, false, false); $this->assertEquals($SINGLESTEP_REQUESTS, $actualRequests); }
public function setUp() { global $SINGLESTEP_PAGE_RUN_DATA; $this->expectedData = $SINGLESTEP_PAGE_RUN_DATA; $this->extractPath = TestUtil::extractToTemp(__DIR__ . "/data/singlestepResults.zip"); if (!$this->extractPath) { $this->fail("Failed to extract results to temp dir"); } $this->resultPath = $this->extractPath . "/singlestepResults"; date_default_timezone_set("UTC"); // to make the test consistent with the result }
public function testWithSinglestepResults() { $this->tempDir = TestUtil::extractToTemp(__DIR__ . '/data/singlestepResults.zip'); $resultdir = $this->tempDir . '/singlestepResults'; $testInfo = TestInfo::fromFiles($resultdir); $this->assertTrue($testInfo->isComplete()); $this->assertTrue($testInfo->isFirstViewOnly()); $this->assertEquals(1, $testInfo->getRuns()); $this->assertTrue($testInfo->isRunComplete(1)); $this->assertFalse($testInfo->isRunComplete(2)); $this->assertEquals(1, $testInfo->stepsInRun(1)); $this->assertEquals($resultdir, $testInfo->getRootDirectory()); // these values are static from a test, but the assertions make sure we don't break the methods $this->assertEquals("160620_DQ_7", $testInfo->getId()); $this->assertEquals("http://www.google.de", $testInfo->getUrl()); $this->assertEquals("Firefox, Internet Explorer and Chrome - <b>Chrome</b> - <b>Cable</b>", $testInfo->getTestLocation()); $this->assertEquals("ITERAHH-VBOX-01-192.168.188.112", $testInfo->getTester(1)); }
public function testJsonResultArrayGeneration() { global $SINGLESTEP_JSON_RESULT_ARRAY; $this->tempDir = TestUtil::extractToTemp(__DIR__ . '/data/singlestepResults.zip'); $testInfo = TestInfo::fromFiles($this->tempDir . '/singlestepResults'); $imitatedPath = $this->imitatedResultPath($testInfo->getId()); // we need to move the results to a directory structure that equal to the real one. // Then, we can go into the parent directory, so the relatece "testRoot" is the same as it would be in production // This is important, as during XML generation, some URLs contain the test path mkdir($this->tempDir . $imitatedPath, 0777, true); rename($this->tempDir . '/singlestepResults', $this->tempDir . $imitatedPath); $this->orgDir = getcwd(); chdir($this->tempDir); $testRoot = "." . $imitatedPath; $testInfo = TestInfo::fromFiles($testRoot); $testResults = TestResults::fromFiles($testInfo); $jsonGenerator = new JsonResultGenerator($testInfo, "http://wpt-test-vm", new FileHandler()); $resultArray = $jsonGenerator->resultDataArray($testResults, "loadTime"); $this->assertThat($resultArray, new IsArraySubsetConstraint($SINGLESTEP_JSON_RESULT_ARRAY)); }
public function testCompleteXmlGeneration() { $this->tempDir = TestUtil::extractToTemp(__DIR__ . '/data/singlestepResults.zip'); $testInfo = TestInfo::fromFiles($this->tempDir . '/singlestepResults'); $imitatedPath = $this->imitatedResultPath($testInfo->getId()); // we need to move the results to a directory structure that equal to the real one. // Then, we can go into the parent directory, so the relatece "testRoot" is the same as it would be in production // This is important, as during XML generation, some URLs contain the test path mkdir($this->tempDir . $imitatedPath, 0777, true); rename($this->tempDir . '/singlestepResults', $this->tempDir . $imitatedPath); $this->orgDir = getcwd(); chdir($this->tempDir); $testRoot = "." . $imitatedPath; $testInfo = TestInfo::fromFiles($testRoot); $expectedXmlFile = __DIR__ . '/data/singlestepXmlResult.xml.gz'; $testResults = TestResults::fromFiles($testInfo); $xmlGenerator = new XmlResultGenerator($testInfo, "http://wpt-test-vm", new FileHandler(), $this->allAdditionalInfo, true); $xmlGenerator->printAllResults($testResults, "loadTime", null); $this->assertThat(ob_get_contents(), IsCompatibleXMLConstraint::fromFile($expectedXmlFile)); }
public function setUp() { $this->tempDir = TestUtil::extractToTemp(__DIR__ . '/data/multistepResults.zip'); $this->resultDir = $this->tempDir . '/multistepResults'; }