infection icon indicating copy to clipboard operation
infection copied to clipboard

Allow multiple test frameworks to be used for one run

Open BackEndTea opened this issue 6 years ago • 0 comments

Currently infection support PHPUnit, PhpSpec, and in the future Codeception #143. There is also interest in adding Behat #147.

A lot of projects use a combination of test frameworks. They may use PHPUnit for the unit tests, and Behat for feature/e2e tests. So if you ran infection on those projects, you'd like infection to use all the test frameworks possible.

configuration

Currently infection.json has the following option

"phpUnit": {
    "configDir": "app",
    "customPath": "\/path\/to\/phpunit-6.1.phar"
}

I would propose to put this config within a testframework option. Not having that set would default it to standard phpunit. It could look something like this:

"testFrameworks": {
  "phpUnit": {
    "configDir": "app",
     "customPath": "\/path\/to\/phpunit-6.1.phar"
  },
  "phpSpec":  true,
  "behat": true
}

So just setting it with true would enable the test-framework with default option, and additional configs for the framework can be supplied the same way as phpunit.

implementation This change is going to have a few challenges.

The simpelest way is to simply run all possible tests in sequence, so first try the PhpUnit tests, if those all succeed try the phpSpec tests, and so on.

A nice 'features' for this would be to be able to set different time outs for different test frameworks. ( I expect my behat tests to take longer than my PhpUnit tests).

Implementing this will probably be a lot of work, so any ideas etc are welcome.

BackEndTea avatar Feb 05 '18 21:02 BackEndTea