2

I'm implementing some tests using the D7 testing framework.

All is good, except that the numbers don't seem to add up, and I wondered how pass/fail was evaluated?

The problem is that I'm getting "6 passes, 0 fails, 4 exceptions, and 2 debug messages" for two test methods.

Obviously I'm missing something, but I had assumed that a single test method would produce a single pass/fail and therefore I should only have two results.

Secondly, how can I find out more information about the exceptions that were reported?

Thanks everyone.

5

Each assert()ion you have in your test code will result in a pass, fail or even an exception. The uncaught exceptions are bad fails.

If you're running your tests with scripts/run-tests.sh, then use the --verbose flag and you'll be able to see the result of each assertion and any associated error/s.

  • Thanks Dave, that makes sense. I'd vote up, but it seems I need more rep. – iainp999 Sep 12 '11 at 8:18
2

Many, many internal methods run asserts, even setup. Almost all drupal* methods do, for example, drupalCreateUser, drupalCreateUser, drupalLogin, drupalGet'drupalPost`.

  • Thanks chx, that also helps expand on Dave's answer too. – iainp999 Sep 12 '11 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.