Пример #1
0
 public function printResult(PrintResultEvent $e)
 {
     $printer = $e->getPrinter();
     if (!$this->settings['enabled']) {
         $printer->write("\nCodeCoverage is disabled in `codeception.yml` config\n");
         return;
     }
     if (!$this->options['quiet']) {
         $this->printConsole($printer);
     }
     $printer->write("Remote CodeCoverage reports are not printed to console\n");
     $this->printPHP();
     $printer->write("\n");
     if ($this->options['coverage-html']) {
         $this->printHtml();
         $printer->write("HTML report generated in {$this->options['coverage-html']}\n");
     }
     if ($this->options['coverage-xml']) {
         $this->printXml();
         $printer->write("XML report generated in {$this->options['coverage-xml']}\n");
     }
     if ($this->options['coverage-text']) {
         $this->printText();
         $printer->write("Text report generated in {$this->options['coverage-text']}\n");
     }
 }
 /**
  * @param PrintResultEvent $printResultEvent
  * @throws \Codeception\Exception\ModuleRequireException
  */
 public function resultPrintAfter(PrintResultEvent $printResultEvent)
 {
     if (count($this->failedIdentifiers) > 0) {
         $items = '';
         $itemTemplate = new \Text_Template($this->config['templateFolder'] . 'Item.html');
         foreach ($this->failedIdentifiers as $vars) {
             $itemTemplate->setVar($vars);
             $items .= $itemTemplate->render();
         }
         $pageTemplate = new \Text_Template($this->config['templateFolder'] . 'Page.html');
         $pageTemplate->setVar(array('items' => $items));
         $reportPath = $this->fileSystemUtil->getFailImageDirectory() . 'index.html';
         $pageTemplate->renderTo($reportPath);
         $printResultEvent->getPrinter()->write('Report has been created: ' . $reportPath . "\n");
     }
 }
Пример #3
0
 public function saveFailed(PrintResultEvent $e)
 {
     $file = $this->getLogDir() . $this->config['file'];
     $result = $e->getResult();
     if ($result->wasSuccessful()) {
         if (is_file($file)) {
             unlink($file);
         }
         return;
     }
     $output = [];
     foreach ($result->failures() as $fail) {
         $output[] = $this->localizePath(Descriptor::getTestFullName($fail->failedTest()));
     }
     foreach ($result->errors() as $fail) {
         $output[] = $this->localizePath(Descriptor::getTestFullName($fail->failedTest()));
     }
     file_put_contents($file, implode("\n", $output));
 }
Пример #4
0
 public function printResult(PrintResultEvent $e)
 {
     if ($this->options['steps']) {
         return;
     }
     $printer = $e->getPrinter();
     $this->printConsole($printer);
     $this->printPHP();
     $printer->write("\n");
     if ($this->options['coverage-html']) {
         $this->printHtml();
         $printer->write("HTML report generated in {$this->options['coverage-html']}\n");
     }
     if ($this->options['coverage-xml']) {
         $this->printXml();
         $printer->write("XML report generated in {$this->options['coverage-xml']}\n");
     }
     if ($this->options['coverage-text']) {
         $this->printText();
         $printer->write("Text report generated in {$this->options['coverage-text']}\n");
     }
 }
Пример #5
0
 /**
  * @param PrintResultEvent $event
  */
 public function afterResult(PrintResultEvent $event)
 {
     $result = $event->getResult();
     if ($result->skippedCount() + $result->notImplementedCount() > 0 and $this->options['verbosity'] < OutputInterface::VERBOSITY_VERBOSE) {
         $this->output->writeln("run with `-v` to get more info about skipped or incomplete tests");
     }
     foreach ($this->reports as $message) {
         $this->output->writeln($message);
     }
 }
 public function testResults(\Codeception\Event\PrintResultEvent $e)
 {
     $passed = count($e->getResult()->passed());
     $skipped = $e->getResult()->skippedCount();
     $errors = $e->getResult()->errorCount();
     $failures = $e->getResult()->failureCount();
     $time = $e->getResult()->time();
     $wasSuccessful = $e->getResult()->wasSuccessful();
     $count = $e->getResult()->count();
     if ($wasSuccessful) {
         teamcity_console_logger(MessageTemplate::Log("Test Pass({$passed})"));
         teamcity_console_logger(MessageTemplate::Log("Test Skipped({$skipped})"));
         teamcity_console_logger(MessageTemplate::Log("Test Error({$errors})"));
         teamcity_console_logger(MessageTemplate::Log("Test Failures({$failures})"));
         teamcity_console_logger(MessageTemplate::Log("Test Total({$count})"));
         teamcity_console_logger(MessageTemplate::BuildStatus('SUCCESS'));
     } else {
         teamcity_console_logger(MessageTemplate::BuildStatus('FAILURE'));
     }
 }