/** * @param Properties $properties */ private function getTotalTestCount(Properties $properties) { $count = 0; foreach ($properties->getTestSets() as $sessionName => $testSets) { foreach ($testSets as $testSet) { $count += $testSet->getTestCount(); } } return $count; }
public function testPreRun() { $properties = Properties::createByYamlFile(__DIR__ . $this->yamlTestSuiteConfig, new Uri('http://www.example.com'), new Dispatcher()); ob_start(); $this->listener->preRun($properties); $output = ob_get_contents(); ob_clean(); $expected = " Default Domain : http://www.example.com\n Start Time : 2011-02-14 16:43:09\n\n" . " Number of URIs : 3\n Number of Tests : 6\n\n"; $output = explode("\n", $output); $this->assertEquals(' Default Domain : http://www.example.com/', $output[0]); $this->assertEquals(' Number of URIs : 3', $output[3]); $this->assertEquals(' Number of Tests : 6', $output[4]); }
/** * This function runs all test sets defined in the properties file. * * @notify LiveTest.Run.PostRun * @notify LiveTest.Run.PreRun */ public function run() { $this->eventDispatcher->simpleNotify('LiveTest.Run.PreRun', array('properties' => $this->properties)); // @todo move timer to runner.php $timer = new Timer(); foreach ($this->properties->getTestSets() as $sessionName => $testSets) { foreach ($testSets as $testSet) { $this->runTestSet($testSet, $sessionName); } } $information = new Information($timer->stop(), $this->properties->getDefaultDomain()); $this->eventDispatcher->simpleNotify('LiveTest.Run.PostRun', array('information' => $information)); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->defaultUri = new Uri('http://www.example.com/index.html'); $this->dispatcher = new Dispatcher(); $this->preRunListener = new PreRunListener('', $this->dispatcher); $this->dispatcher->connectListener($this->preRunListener); $this->postRunListener = new PostRunListener('', $this->dispatcher); $this->dispatcher->connectListener($this->postRunListener); $this->connectionStatusListener = new ConnectionStatusListener('', $this->dispatcher); $this->dispatcher->connectListener($this->connectionStatusListener); $this->infoListener = new InfoListener('', $this->dispatcher); $this->dispatcher->connectListener($this->infoListener); $this->handleResultListener = new HandleResultListener('', $this->dispatcher); $this->dispatcher->connectListener($this->handleResultListener); $this->properties = Properties::createByYamlFile(__DIR__ . '/Fixtures/testsuite.yml', $this->defaultUri, new Dispatcher()); $this->httpClients['default'] = new HttpClientMockup(new ResponseMockup()); $this->run = new Run($this->properties, $this->httpClients, $this->dispatcher); }
/** * @expectedException LiveTest\ConfigurationException */ public function testCreateByYamlFileConfigurationException() { Properties::createByYamlFile(__DIR__ . '/Fixtures/testsuite_error.yml', new Uri("http://www.example.com"), new Dispatcher()); }
/** * Initializes the test run. */ private function initTestRun() { $this->eventDispatcher->simpleNotify('LiveTest.Runner.InitTestRun'); try { $properties = Properties::createByYamlFile($this->getArgument('testsuite'), $this->config->getDefaultDomain(), $this->eventDispatcher); } catch (\Zend\Config\Exception\InvalidArgumentException $e) { throw new ConfigurationException('The given testsuite configuration file ("' . $this->getArgument('testsuite') . '") was not found.', null, $e); } catch (\InvalidArgumentException $e) { throw new ConfigurationException('Error parsing testsuite configuration: ' . $e->getMessage(), null, $e); } if (!$properties->hasSessions()) { throw new ConfigurationException('No sessions were defined in the testsuite configuration'); } $clients = $this->getClients($properties->getSessions()); $this->testRun = new Run($properties, $clients, $this->eventDispatcher); }