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

1397 questions
88
votes
8 answers

How can I run only one test from a suite?

I have this test class below, and I want to run only one test from it, for example the "aboutPage". Any ideas how? This is how I run only this file: codecept run tests/acceptance/VisitorCest.php But now I want to run only one test from the…
Tzook Bar Noy
  • 10,111
  • 12
  • 45
  • 75
55
votes
1 answer

Codeception, write acceptance tests with the pageObject design pattern and gherkin

I'm looking for a simple example of code with the pageObject design pattern and gherkin because when I follow the codeception BDD documentation, all examples written in the tests/support/AcceptanceTester.php. I don't understand (poor English skills…
matthieu lopez
  • 1,558
  • 4
  • 24
  • 61
41
votes
7 answers

Printing debug output to console in Codeception

Very thick question, but is there any way to print your own debug messages to the console in Codeception? I mean messages that have nothing to do with assertions, purely for debugging the tests themselves (e.g. like you would var_dump() a variable…
Ayame__
  • 882
  • 2
  • 9
  • 21
32
votes
3 answers

Codeception - What is the difference between cest and cept?

I just started using TDD approach and came across codeception. I searched the web a lot but didn't find a proper explanation or differentiation between cest and cept files in codeception.
aBhijit
  • 4,524
  • 8
  • 32
  • 53
26
votes
6 answers

Debugging Codeception tests with Xdebug

I wrote some API tests with Codeception's ApiGuy. Now I want to set breakpoints in my PhpStorm 7 for tests debugging, but have no idea how to start debug session after $ vendor/bin/codecept run. I know about --debug option, but it's not exactly what…
Vitaly Chirkov
  • 1,659
  • 2
  • 17
  • 31
25
votes
1 answer

Failing to run Codeception tests with code coverage

I'm getting an error when I try to run tests using the --coverage flag. Input php codecept.phar run acceptance testCest.php --coverage Output [ErrorException] file_get_contents(http://project.local/c3/report/clear): failed to open stream: HTTP…
jastew
  • 323
  • 3
  • 8
24
votes
8 answers

Use CodeCeption assertion in conditional (if) statement

I'm totally new with CodeCeption. I want to do an action/assertion depending on another assertion result, like this: if ($I->see('message')){ $I->click('button_close'); } Is something like that possible? I tried, but doesn't work. Probably…
Borjovsky
  • 556
  • 2
  • 7
  • 21
22
votes
7 answers

Codeception: Keep a logged in state

I want to keep or run the login before most of my tests. But if I try to move the login code to _before it doesn't work since there is no webguy instance available to me. What is the best way to keep the session between multiple tests? This is my…
Ms01
  • 3,936
  • 6
  • 42
  • 75
18
votes
5 answers

Switch db connection dynamically

For several console commands, I have the need to change databases so all my eloquent commands and queries run on the correct db (and server). Ive seen a few solutions, the simplest seems to be changing the config like so: $new_connection = [ …
Parampal Pooni
  • 2,618
  • 7
  • 30
  • 37
18
votes
3 answers

Can Travis-CI run Codeception tests?

I'm creating my tests (though I'm a beginner, learning) using Codeception. This includes acceptance and unit tests for now. I want to add my repo to Travis CI so I can automate testing process after each commit and put build-status tag. I would like…
Aristona
  • 6,763
  • 8
  • 45
  • 75
17
votes
2 answers

`[Exception] DateTime::__construct(): `It is not safe to rely on the system's timezone settings

I 'm using codeception (bdd) making test but gives error [Exception] DateTime::__construct(): It is not safe to rely on the system's timezone…
kemal
  • 371
  • 2
  • 4
  • 13
16
votes
2 answers

How to setup Codeception with remote code coverage?

I have two repo on my machine API Codeception repo that tests API In API repo I have added codeception+c3 "require-dev": { "codeception/codeception": "2.*", "codeception/c3": "2.*", I've also included c3.php inside index.php, but when…
Ivan Z. Horvat
  • 345
  • 1
  • 3
  • 13
16
votes
5 answers

How to skip a Codeception cest test

I want to skip only one test in a codeception cest test. Using Cept tests you can do $scenario->skip(); but does not work for Cest tests. So I want to do something like this. Run the first test, but skip the second one. Class MyTests{ public…
Kotie Smit
  • 546
  • 1
  • 4
  • 15
15
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
  • 936
  • 1
  • 14
  • 34
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
  • 622
  • 2
  • 6
  • 23
1
2 3
93 94