Questions tagged [codeception]

Codeception is a modern full-stack testing framework for PHP. Inspired by BDD, it provides a way of writing acceptance, functional and even unit tests. Powered by PHPUnit.

Codeception is a PHP full-stack testing framework. Inspired by BDD, it provides a new way of writing acceptance, functional and even unit tests. Powered by PHPUnit.

Feature Overview:

  • Multiple backends, easily changed , PhpBrowser
  • Elements matched by name, CSS, XPath
  • Data Cleanup after each run
  • Integrate with Symfony, Zend Framework, Laravel, Yii and other frameworks
  • Continuous Integration systems like Jenkins or Bamboo
  • Natively executes PHPUnit tests
  • BDD-style scenario-driven tests
  • WebServices testing via REST,SOAP
  • Generates HTML, XML, TAP, JSON reports
  • Simple Fixtures
  • Database and Doctrine ORM helpers
  • CodeCoverage and Remote CodeCoverage

Documentation & Links

Available modules for frameworks

1468 questions
16
votes
4 answers

Codeception run before all tests inside a CEST

I want to run something before all the tests inside a particular Cest, and then clean it up after all tests have run, similar to the setUpBeforeClass and tearDownAfterClass method in PHPUnit. Is there a method to do something like this in…
Casteurr
  • 956
  • 3
  • 16
  • 35
15
votes
1 answer

Error when trying to accept a native js popup with Codeception and Yii2

I'm trying to close a confirm js popup generated by Yii2 for confirmation of the deletion of the record, in this case a user, with Codeception and his. Below is the error: [WebDriverException] JSON decoding of remote response failed. Error code:…
VictorArcas
  • 630
  • 2
  • 7
  • 23
14
votes
3 answers

how to get current url from codeception & phantomjs test?

I am creating product in estore with my test, and need to get url after submitting a form. Is it possible to get url in the test scope after submitting button ? $I->click('#formSubmit'); $I->wait(5); // wait for redirect to new url $url =…
Ilja
  • 1,205
  • 1
  • 16
  • 33
14
votes
6 answers

How to use dynamic urls in acceptance tests from command line with Codeception

I have two php envs and I am currently able to run something like this for different urls modules: enabled: - WebDriver - AcceptanceHelper config: WebDriver: url: 'http://localhost/' browser:…
Supra
  • 1,612
  • 1
  • 18
  • 36
14
votes
1 answer

How to include failed screenshots into the codeception report

Just started using codeception 2.0.9 and have installed it with phantomjs and got some sample tests running. Codeception gives a concise html report at the end that summarises passed tests in red and green, which is nice. In the reporting directory…
boran
  • 361
  • 2
  • 7
13
votes
8 answers

PHP Startup: Unable to load dynamic library, when running unit tests

when I try to run my unit tests, I get this error PHP Warning: PHP Startup: Unable to load dynamic library 'bz2' (tried: \xampp\php\ext\bz2 (The specified module could not be found.), \xampp\php\ext\php_bz2.dll (The specified module could not…
Adam Beňko
  • 221
  • 3
  • 4
  • 11
13
votes
1 answer

Laravel 5 / Codeception not routing correctly

I'm trying to write an API test case for a controller function using codeception, and I'm hitting an issue where the route to the controller function does not appear to be evaluated correctly, and the evaluation seems to be different depending on…
delatbabel
  • 3,601
  • 24
  • 29
13
votes
3 answers

Codeception\Util\Stub methods ::exactly and ::once don't work

I am using Codeception\Util\Stub to create unit tests. And I want to be sure that my method called several times. For this I am using method 'exactly'. Example: use \UnitTester; use \Codeception\Util\Stub as StubUtil; class someCest { public…
vatvit
  • 131
  • 1
  • 5
13
votes
5 answers

How to use PHPUnit assert methods in a Codeception functional test?

I'm using Codeception for unit, functional, and acceptance tests of my Laravel 4 PHP application. My unit tests look this: use Codeception\Util\Stub; class ExampleTest extends \Codeception\TestCase\Test { public function testExample() { …
mtmacdonald
  • 14,216
  • 19
  • 63
  • 99
12
votes
2 answers

The error “base64: unrecognized option: w” is output in alpine linux

The following error was output when executing codecept -c src run acceptance command on alpine linux: none base64: unrecognized option: w BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary. Usage: base64 [-d] [FILE] Base64 encode or…
kodomo
  • 123
  • 1
  • 1
  • 5
12
votes
2 answers

Using two databases at the same time in codeception

How can I use two databases at the same time in codeception? My PHP app uses an SQLite database, but also connects with another app that uses a MySQL database. At the moment I have this in my codeception.yml file: modules: config: Db: …
Ivan
  • 1,801
  • 2
  • 23
  • 40
12
votes
4 answers

Codeception Cept tests _bootstrap variables

Codeception default _bootstrap.php file states:
Igor Pantović
  • 9,107
  • 2
  • 30
  • 43
12
votes
1 answer

Using different codeception environments

I am working on some Unit Tests for an API using Codeception. The idea is to make sure that each API call returns the expected response codes and a JSON object in a desired format. The problem that I have is that I need to use different URLs…
woodgate
  • 183
  • 1
  • 8
11
votes
3 answers

Codeception & Symfony - run Doctrine migrations before tests

I have a Symfony 4 application and Doctrine with Doctrine migrations. I'm introducing Codeception for running API tests, and need to run migrations before the tests run. Since I'm using the Doctrine2 module I don't really want to be also including…
Chris Brown
  • 4,445
  • 3
  • 28
  • 36
11
votes
3 answers

XPath for text after

Looking to get the XPath of $2.00 with this block:
kapperkp
  • 199
  • 1
  • 3
  • 14
1
2
3
97 98