Why are specific asserts better than generic asserts, in PHPUnit?

phpunit, testing, unit-testing

Solution

If you showed your mum/dad/uncle those, the `assertGreaterThan` is far more intuitive. Plus the failed message for the isGreaterThan will be much better

"1 was not greater than 2"

or

"false was not true"

Which one is more expressive?

Problem

Please excuse my ignorance; I am still new to the unit testing realm. Can someone explain why.. `$this->assertGreaterThan( 2, $result );` ..is better than.. `$this->assertTrue( $result > 2 );` ..(and likewise, all the other specific assert methods)? Thanks!

Original source