Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Wojciech Sznapka's Blog:
Fully isolated tests in Symfony2
Jun 15, 2011 @ 16:18:49

Wojciech Sznapka has a new post to his blog today looking at his creation of fully isolated tests as a part of a Symfony2 application. He talks about two issues he recently solved with testing services in this popular framework.

The most important thing you should provide with your re-usable bundles is unit tests set. Lately I solved two major cases which Symfony2 hasn’t got out of the box: testing services, defined in Dependency Injection Container and running model tests with fixtures in fully isolated environment.

He includes code snippets for both solutions - a BaseTestClass for working with dependency injection testing and a ModelTestCase class that, in the setUp(), loads in the required fixtures so the test can be completely isolated.

tagged: symfony2 isolated unittest dependencyinjection fixtures doctrine2

Link:

Sebastian Bergmann's Blog:
Isolated (and Parallel) Test Execution
Dec 19, 2007 @ 21:26:00

Sebastian Bergmann points out a new feature that PHPUnit (the popular PHP unit testing tool) now has - parallel_test_execution allowing for each test to execute on a separate PHP process.

The advantages of this include full test isolation and the fact that a test can now cause a PHP fatal error or even a segmentation fault of the PHP interpreter without interrupting the test execution.

He does mention, however, that it can cause a bit more overhead for larger testing suites since it needs to create a new process (complete with memory usage) for each running test. There are also coding issues that could be thrown off by this option (he gives an example of an inheritance issue with eZ Components).

He also notes some of his thoughts on how to control/configure the process (like in a configuration file) and via an "@isolated" notation to make it easy to do it dynamically.

tagged: phpunit seperate process unittest execute overhead configure isolated phpunit seperate process unittest execute overhead configure isolated

Link:

Sebastian Bergmann's Blog:
Isolated (and Parallel) Test Execution
Dec 19, 2007 @ 21:26:00

Sebastian Bergmann points out a new feature that PHPUnit (the popular PHP unit testing tool) now has - parallel_test_execution allowing for each test to execute on a separate PHP process.

The advantages of this include full test isolation and the fact that a test can now cause a PHP fatal error or even a segmentation fault of the PHP interpreter without interrupting the test execution.

He does mention, however, that it can cause a bit more overhead for larger testing suites since it needs to create a new process (complete with memory usage) for each running test. There are also coding issues that could be thrown off by this option (he gives an example of an inheritance issue with eZ Components).

He also notes some of his thoughts on how to control/configure the process (like in a configuration file) and via an "@isolated" notation to make it easy to do it dynamically.

tagged: phpunit seperate process unittest execute overhead configure isolated phpunit seperate process unittest execute overhead configure isolated

Link:


Trending Topics: