Codeception: How to use configuration.xml (phpunit) with codeception

Created on 28 Aug 2015  路  6Comments  路  Source: Codeception/Codeception

Hi,

We have already created a lot of tests for phpunit. Recently we wan't to use our acceptance test with codeception.
The idea is to move the unittests to the unit folder in codeception.

We run our phpunit test with the configuration.xml file. See: https://phpunit.de/manual/current/en/appendixes.configuration.html

Is it possible to use this configuration file in codeception when we run our unit tests?

Most helpful comment

related: does anyone know how to add a PHPUnit listener within _bootstrap.php (which would typically be included in the phpunit.xml I guess?) e.g.:

<listeners>
      <listener class="PHPUnit_Util_Log_VCR" file="vendor/php-vcr/phpunit-testlistener-vcr/PHPUnit/Util/Log/VCR.php" />
    </listeners>

Is there a programmatic way of doing this in the bootstrap file?

All 6 comments

No, Codeception does not use phpunit.xml config. But the idea to move tests to unit folder is good. What do you actually need from your old PHPUnit config?

I wan't to use the bootstrap file and the testsuites that we have created. Is this possible in another way?

Yes, you can use _bootstrap.php of Codeception located in tests/unit/_bootstrap.php.

As for test suites we only have unit/functional/acceptance/+you can add more but they will be located in separate directories with custom configuration. So probably you can't use subsuites for unit tests.

Ok. Thanks for the quick response. I wil have a look at the _bootstrap.php file. That's the most important for us at the moment.

_bootstrap is empty, it will be required before all unit tests.

related: does anyone know how to add a PHPUnit listener within _bootstrap.php (which would typically be included in the phpunit.xml I guess?) e.g.:

<listeners>
      <listener class="PHPUnit_Util_Log_VCR" file="vendor/php-vcr/phpunit-testlistener-vcr/PHPUnit/Util/Log/VCR.php" />
    </listeners>

Is there a programmatic way of doing this in the bootstrap file?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Breadleyg picture Breadleyg  路  3Comments

gimler picture gimler  路  3Comments

Renkas picture Renkas  路  3Comments

m4rcinkowski picture m4rcinkowski  路  4Comments

joshhornby picture joshhornby  路  3Comments