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
94
votes
9 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
  • 11,337
  • 14
  • 51
  • 82
56
votes
2 answers

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…
spacecodeur
  • 2,206
  • 7
  • 35
  • 71
50
votes
10 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__
  • 980
  • 2
  • 9
  • 21
35
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
  • 5,261
  • 10
  • 36
  • 56
27
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…
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,692
  • 3
  • 17
  • 33
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
  • 9
24
votes
8 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
  • 4,420
  • 9
  • 48
  • 80
21
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,958
  • 8
  • 34
  • 40
19
votes
2 answers

Codeception4: GroupManager reports missing test file

I upgraded Codeception to v4 (according to THIS) and then Symfony to v5 (according to THIS). Now, when I try to run tests I get an error about missing test file: root@blabla: vendor/bin/codecept run In GroupManager.php line 129: GroupManager: File…
callmebob
  • 6,128
  • 5
  • 29
  • 46
18
votes
6 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
  • 646
  • 1
  • 5
  • 18
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
  • 8,611
  • 9
  • 54
  • 80
17
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
  • 385
  • 1
  • 4
  • 14
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
  • 14
17
votes
3 answers

Select an option in a dynamic select with codeception?

Select the first dynamic option
Michael J. Calkins
  • 32,082
  • 15
  • 62
  • 91
1
2 3
97 98