I have just added Codeception to some of my projects but its performance is unacceptable for failing tests. Passing tests execute in 0.1s or less but failing tests take between 15 minutes and 1.5 hours each. When they finally fail, they dump hundreds of kilobytes to the console. There is a lot of mention of Selenium, which I don't understand because so far I'm only using unit tests, not acceptance tests or functional tests so I don't see why it should need Selenium. Why is it so slow? Is there something I can configure to make a failing test run as fast as a passing test? These are the tests I'm using:
<?php
class englishTest extends \Codeception\Test\Unit {
/**
* @var \UnitTester
*/
protected $tester;
protected function _before() {
include_once('country.model.php');
}
protected function _after() {
}
// tests
public function testCreateCountryModel() {
$country = new CountryModel;
$this->assertEquals('Afghanistan', $country->get_all_countries()[0]);
}
public function testGetCountriesEndingWithEndOfWord() {
$country = new CountryModel;
$this->assertEquals(['Costa Rica', 'Dominica', 'Jamaica', 'South Africa'], $country->get_countries_ending_with('ca'));
}
}
This is the output when the tests pass:
C:\server\Apache24\htdocs\localhost\public_html\english>codecept run
Codeception PHP Testing Framework v2.2.1
Powered by PHPUnit 4.8.26 by Sebastian Bergmann and contributors.
Acceptance Tests (0) ---------------------------------------
------------------------------------------------------------
Functional Tests (0) ---------------------------------------
------------------------------------------------------------
Unit Tests (2) ---------------------------------------------
+ englishTest: Create country model (0.1s)
+ englishTest: Get countries ending with end of word
------------------------------------------------------------
Time: 2.23 seconds, Memory: 11.00MB
OK (2 tests, 2 assertions)
Aucun commentaire:
Enregistrer un commentaire