B
B
BonBon Slick2018-08-30 11:47:25
Unit testing
BonBon Slick, 2018-08-30 11:47:25

How to make test errors more informative?

Time: 3.84 seconds, Memory: 10.00MB

There was 1 error:

1) App\Tests\Functional\AuthFunctionalTest::AuthenticationForm_WithValidCredentials_Submit with data set #0 ('/en/login')
LogicException: The request was not redirected.

/var/www/qqqq/vendor/symfony/browser-kit/Client.php:527
/var/www/qqqq/src/Tests/Functional/AuthFunctionalTest.php:53

ERRORS!
Tests: 2, Assertions: 3, Errors: 1.

And it's not clear why it gives an error, and so with many tests, sit and guess why it throws it out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2018-08-30
@BonBonSlick

And it's not clear why it gives an error, and so with many tests, sit and guess why it throws it out.
No need to guess , you need to debug . In this case, obviously, the authorization has broken. Why it broke the tests themselves will not know. Therefore, you need to add more tests and checks to them, so that in the event of a fall, you can clearly understand where something broke.
In the case of authorization, for example, you can first check that the user has been authorized, and then that a redirect has occurred. Then it will be possible to immediately say in case of a redirect error - authorization works, but the redirect is broken.
Also, test frameworks usually accept a textual description of the error so that the programmer can describe the problem in a language he understands and add some details: current iteration data, response text, session errors, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question