Meet the Nette Tester

8 years ago by Miloslav Hůla  

Have you ever written following code in PHP?

$obj = new MyClass;
$result = $obj->process($input);

var_dump($result);

So, have you ever dumped a function call result just because to check it by eye that it returns what it should return? You surely do it many times per day. In case everything works do you delete this code and do you expect that the class will not be broken in the future? Murphy's Law guarantees the opposite ;-)

In fact, we wrote the test. And if we didn’t delete it we could run it any time in the future to verify that everything still works as it should. You may create a large amount of these tests over time, so it would be nice if we were able to run them automatically. It would be useful to slightly modify test not to require our inspection, simply to be able to check itself.

And the Nette Tester helps exactly with that. Meet the Nette Tester in the introduction

Further reading

Comments (RSS)

  1. var_dump() isn't really a test, you usually want to check that some value is present or has some value.

    8 years ago

Sign in to submit a comment