Changes in Tester 1.4.0

by Miloslav Hůla 4 years ago in Tester

The Nette Tester 1.4.0 has been released one month ago. I would like to describe new features now, they are in the name of XML.

The code coverage functionality (via --coverage parameter) is present in the Tester for a long time. Report is formatted in an HTML, pleasant for programmer eyes. The Tester supports XML format now, perfect for a machine processing. The format is known as a CloverXML format. It is borrowed from the Java world, but it is quite spreaded in the PHP world too. For example, PhpStorm and Netbeans IDEs can load such report and helps you to visualize, how is the code covered by tests. The CloverXML format is supported by some CI tools too, e.g. Scruntinizer and Jenkins CI, or by specialized services like Coveralls. If you are curious how the CloverXML format looks like, you can take a look at Tester's test.


Changes in Nette Tester 1.3.1

by Miloslav Hůla 4 years ago in Tester

The Nette Tester 1.3.1 has been released just yesterday. This new patch version fixes few minor bugs.

The FileMock does not use uniqid() anymore and it numbers mocked files sequentially. It prevents possible collisions.

You can acquire multiple locks in one test by the Environment::lock() now. Before 1.3.1, every next lock may release the previous one.

If you use the --stop-on-fail option, the testing progress is stopped in initial phase too. For example, if you forgot to call (new TestCase)->run() in a @testCase annoted file.

If you are familiar with the Tester, you know that a test will fail when does not invoke any assetion. This feature didn't work with HHVM < 3.4.0 because of HHVM bug. Since the HHVM 3.4.0 this feature works.

Beside the fixes, the --info output has been concentrated a little bit.

And that's all. Enjoy the testing!

Changes in Nette Tester 1.3.0

by Miloslav Hůla 4 years ago in Tester

I would like to describe news and changes in Nette Tester 1.3.0. I'll start from the tiny one.

The FileMock class, introduced in the 1.2.0, now works with is_readable() and is_writable() functions.

Next change is a new command line option -o (output format). The option can enumerate from three values: console, tap and none. The console value is the default one. But when explicitly specified, Tester's ASCII logo is not printed. It is handy when Tester runs from IDE. The tap value is Test Anything Protocol output format and it is replacement for deprecated --tap option. This deprecated option has been removed from help screen but still works to keep backward compatibility. The none value suppresses any output, only bad usage exceptions are printed.

And the best for last. Tester now supports HHVM from version 3.3.0. And how to use it? Simply pass HHVM binary name by -p option. For example:

vendor/bin/tester -p hhvm tests

Changes in Nette Tester 1.2.0

by Miloslav Hůla 5 years ago in Tester

Nette Tester is a PHP testing tool. It has been four months since the Tester 1.0.0 has been released, and it is a few days since the version 1.2.0 is out. I would like to describe the changes in here.

If you are interested in how well your tests cover your code, the new Tester's options --coverage cc.html and --coverage-src path should be useful. The first one enables the collection of coverage details, and outputs it in cc.html. You will get a well-arranged HTML report. The second option reduces the path to the analysed source files (instead of passing the directory, you can pass a single file as a path since version 1.2.0).

Since running the tests in parallel has been shown as non-problematic, the tests will now run in 33 parallel threads by default. That's all.

I will describe the next change via an example, imagine this simple test case:

use Tester\Assert;

class MyTest extends Tester\TestCase
    public function testSomething()
        Assert::fail('I have no reason to be a success.');


Meet the Nette Tester

by Miloslav Hůla 5 years ago in Tester

Have you ever written following code in PHP?

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


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 future? Murphy's Law guarantees 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 the 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