Esempio n. 1
0
 public function after(TestEvent $e)
 {
     $seconds_input = $e->getTime();
     // stack overflow: http://stackoverflow.com/questions/16825240/how-to-convert-microtime-to-hhmmssuu
     $seconds = (int) ($milliseconds = (int) ($seconds_input * 1000)) / 1000;
     $time = $seconds % 60 . ($milliseconds === 0 ? '' : '.' . $milliseconds);
     $this->write($e->getTest()->toString());
     $this->writeln(' (' . $time . 's)');
 }
 public function afterTest(TestEvent $e)
 {
     $test = new \stdClass();
     $test->name = \Codeception\Test\Descriptor::getTestFileName($e->getTest());
     // stack overflow: http://stackoverflow.com/questions/16825240/how-to-convert-microtime-to-hhmmssuu
     $seconds_input = $e->getTime();
     $seconds = (int) ($milliseconds = (int) ($seconds_input * 1000)) / 1000;
     $time = $seconds % 60;
     $test->time = $time;
     self::$testTimes[] = $test;
 }
Esempio n. 3
0
 protected function writelnFinishedTest(TestEvent $event, Message $result)
 {
     $test = $event->getTest();
     if ($this->isDetailed($test)) {
         return;
     }
     if ($this->output->isInteractive()) {
         $this->output->write("\r");
     }
     $result->append(' ')->write();
     $this->writeCurrentTest($test, false);
     $conditionalFails = "";
     $numFails = count($this->fails);
     if ($numFails == 1) {
         $conditionalFails = "[F]";
     } elseif ($numFails) {
         $conditionalFails = "{$numFails}x[F]";
     }
     $conditionalFails = "<error>{$conditionalFails}</error> ";
     $this->message($conditionalFails)->write();
     $time = $event->getTime();
     if ($time) {
         $seconds = (int) ($milliseconds = (int) ($time * 100)) / 100;
         $time = $seconds % 60 . '.' . $milliseconds;
         $this->message($time)->prepend('(')->append('s)')->style('info')->write();
     }
     $this->output->writeln('');
 }
 public function testSuccess(\Codeception\Event\TestEvent $e)
 {
     $test = new stdClass();
     $test->name = $e->getTest()->toString();
     $test->time = (int) (int) ($e->getTime() * 1000) / 1000 % 60;
     array_push(self::$testTimes, $test);
     teamcity_console_logger(MessageTemplate::TestSuccess($test->name, $test->time));
 }
Esempio n. 5
0
 /**
  * @param TestEvent $event
  */
 protected function writeTimeInformation(TestEvent $event)
 {
     $time = $event->getTime();
     if ($time) {
         $this->message(number_format(round($time, 2), 2))->prepend('(')->append('s)')->style('info')->write();
     }
 }