Prev | Current Page 333 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


All the assert methods accept a last optional parameter of type PosInfos ; as explained earlier, this is a
special parameter that, when omitted, will be automatically fed by the compiler with an anonymous
object containing information about the code context in that particular position.
The other important class of the package haxe.unit is the TestRunner . This class executes the tests that
inherit from TestCase class, collects their results, and reports them. Each test class is added to a
TestRunner instance using the add methods. They are collectively executed using the method run .
The haxe.unit targets any platform supported by haXe and the results will be reported in text format
as much as the trace function does.
Writing Tests
Without going too deep into the topic (many books and sites discuss the argument), there exists a
technique known as TDD (Test - Driven Development), which advocates that a good practice is to write
the tests before the method implementations. The process is divided in the following steps:
A test is written.


Pages:
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345