jake_feyereisen
jake_feyereisen

Reputation: 739

How to run a single phpUnit test in a separate process?

Is it possible to run a test suite of phpUnit tests in the same process, but identify specific tests to be run in their own processes?

Normally I use

@runTestsInSeparateProcesses
@preserveGlobalState disabled

for an entire test suite, but I only need a single method to be ran separately, and I'd like the speed increase of having the rest run in a single process.

Thanks

Upvotes: 21

Views: 15280

Answers (1)

Nelson Senna
Nelson Senna

Reputation: 646

As you can see in PHPUnit manual you can use the @runInSeparateProcess tag:

class MyTest extends PHPUnit_Framework_TestCase
{
    /**
    * @runInSeparateProcess
    */
    public function testInSeparateProcess()
    {
        // ...
    }
}

Upvotes: 38

Related Questions