REST module prints complete response ("body" report)
Method \Codeception\Module\REST::_failed should take into account shortDebugResponse setting before adding "body" report. Otherwise test output becomes quite unreadable (in case of long responses) even if shortDebugResponse was set to true. Or maybe better create new setting for shortening "body" report (something like shortResponseBody: true). Another solution could be making \Codeception\Test\Metadata::$reports field write-accessible, to allow shortening it in \Codeception\Module::_failed hook
Had the same Problem and found a quick solution so i thought i'd share it:
In the yml config for your suite(e.g. api.suite.yml):
- \Helper\Api:
shortResponseBody: 600
In the Helper Class for your suite(e.g. Api.php):
class Api extends \Codeception\Module
{
...
public function _failed(\Codeception\TestInterface $test, $fail)
{
$body = $test->getMetadata()->getReports()['body'];
$shortResponseBody = $this->_getConfig('shortResponseBody');
if (isset($body) && isset($shortResponseBody) && strlen($body) > $shortResponseBody) {
$start = substr($body, 0, $shortResponseBody / 2);
$end = substr($body, -$shortResponseBody / 2);
$newBody = $start . '\e ... \e' . $end;
$test->getMetadata()->addReport('body', $newBody);
}
}
...
}