From 7c65b2f40ea9242260eac5a746863f5925423861 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 22 Sep 2013 22:39:41 +0200 Subject: Phing: added target for phpunit+selenium Functional tests were using an old selenium RC version. Ported them to use phpunit + selenium; next: opensauce --- tests/test_tools/selenium/php/results.php | 160 ------------------------------ 1 file changed, 160 deletions(-) delete mode 100644 tests/test_tools/selenium/php/results.php (limited to 'tests/test_tools/selenium/php/results.php') diff --git a/tests/test_tools/selenium/php/results.php b/tests/test_tools/selenium/php/results.php deleted file mode 100644 index 77dab43b..00000000 --- a/tests/test_tools/selenium/php/results.php +++ /dev/null @@ -1,160 +0,0 @@ -parse_data(); - $this->browser = $_SERVER['HTTP_USER_AGENT']; - $this->date = time(); - } - - protected function parse_data() - { - $this->result = $_POST['result']; // failed || passed - $this->totalTime = $_POST['totalTime']; - $this->numTestPasses = $_POST['numTestPasses']; - $this->numTestFailures = $_POST['numTestFailures']; - $this->numCommandPasses = $_POST['numCommandPasses']; - $this->numCommandFailures = $_POST['numCommandFailures']; - $this->numCommandErrors = $_POST['numCommandErrors']; - - foreach($_POST['tests'] as $test) - { - $case = new SeleniumTestCaseResult(); - $case->name = $test['testcase']; - $case->commands = $test['commands']; - for($i = 0; $i < count($case->commands); $i++) - { - //$trace = $case->commands[$i]['trace']; - //$trace = html_entity_decode($trace); - //$case->commands[$i]['trace'] = @unserialize($trace); - if($case->commands[$i]['result'] == 'failed') - { - $case->result = 'failed'; - array_push($case->failures, $case->commands[$i]); - } - } - - $this->suites[$case->name] = $case; - } - - } -} - -class SeleniumHtmlReporter -{ - protected $test; - - public function __construct($result) - { - $this->test = $result; - } - - protected function renderHeader() - { - $contents = << - -Functional Test Results - - - - -EOD; - return $contents; - } - - public function render() - { - echo $this->renderHeader(); - echo $this->renderBody(); - echo $this->renderFooter(); - } - - protected function renderBody() - { - /* SeleniumTestResult */ - $test = $this->test; - $total = count($test->suites); - $date = @strftime('%Y-%m-%d %H:%M',$test->date); -$contents = <<Functional Test Results -
- {$total} test cases completed, - {$test->numTestPasses} passes - ({$test->numCommandPasses} commands), and - {$test->numTestFailures} fails - ({$test->numCommandErrors} commands). -
-
- {$date}, {$test->browser} -
-EOD; - $count = 1; - foreach($test->suites as $suite) - { - foreach($suite->failures as $error) - $contents .= $this->getErrorMsg($suite, $error, $count++); - } - - return $contents; - } - - - protected function getErrorMsg($suite, $info, $count) - { - $parity = $count%2==0 ? 'even' : 'odd'; - $command = explode("|",$info['command']); -$msg = << - #{$count}. - "{$info['msg']}" in - - {$suite->name}::{$command[1]}('{$command[2]}'); - - -EOD; - - return $msg; - } - - protected function renderFooter() - { - return ""; - } -} - - -?> \ No newline at end of file -- cgit v1.2.3