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

Brandon Savage:
Don’t write useless unit tests
Jan 17, 2018 @ 16:44:42

Brandon Savage has a quick post to his site sharing some advice around the testing of your application, more specifically around unit tests: don't write useless unit tests. He starts with an example of a test that, while moving the project closer to the 100% coverage number, is mostly useless.

Too often, in the search for 100% unit test code coverage, I see tests like this get written. They don’t serve a practical purpose, except to meet the test coverage goal. Worse, they don’t actually improve the quality of the application.

Instead of writing a unit test here, we would be better served by writing an integration test, or a functional test. These tests would require us to interact directly with the database, but would provide far more valuable information about the health and status of our application. A useless unit test provides us with little if any benefit; a useful functional test provides us with tremendous advantages.

He includes the code for the test and talks about what's wrong with the approach and how it could potentially be handled better. He suggests that writing good, useful tests requires both skill and determination and the avoidance of tests that actually increase the quality of the overall test suite.

tagged: useless unittest tutorial example functional test

Link: https://www.brandonsavage.net/dont-write-useless-unit-tests/

Padraic Brady's Blog:
PHP Framework Benchmarks: Entertaining But Ultimately Useless
Feb 24, 2010 @ 16:51:46

In a new post to his blog Padraic Brady takes a humorous look at benchmarking PHP frameworks in a response to some of the other recent posts from developers on the Symfony and Solar frameworks.

Some recent attention in the PHP framework community has been focused on the recent publication of Symfony 2 Preview benchmarks showing that Symfony 2 outperforms Zend Framework by a factor of 3.5. It also outperforms every other benchmarked framework. [...] My fellow Zend Frameworkers, we cannot allow this to stand. [...] I have created the benchmark of benchmarks. Well, to be honest, I only really edited another benchmark. But still, it will prove Zend Framework is faster than everything else out there.

His benchmarks are a little different from the rest with both the usual comparisons between the framework request numbers and a bit of explanation on how the Zend Framework came out on top - he cheated. What it really boiled down to was how the code that was tested was written. His code was optimized in a few different ways (All-in vs the Optimized/More-Optimized/What-The-Fuck-Optimized) and he includes custom benchmarks to show how they differ. What it really boils down to from his perspective is simply put:

Benchmarks. Useless. Final words? Know your framework! All this benchmarking nonsense does little good unless it's plastered with disclaimers.
tagged: framework benchmarks useless framework

Link:


Trending Topics: