How to inspect a variable when testing with `drush test-run`. When testing with my SimpleTests, I want to inspect a variable. var_dump() and the likes are not being rendered in the output of Drush, Xdebug interactive debugger does not work due to the simulated browser being ran in DrupalWebTest.

How can I render, export, inspect or otherwise dump the contents of a variable in my code? I.e. the DrupalWebTest of dpm(), var_export() and such.
Call DrupalTestCase::assert() passing the message to show.

$this-&gt;assert(TRUE,
  t('Variable content: @variable', array('@variable' =&gt; var_export($variable, TRUE))
);


This is similar to the code used by DrupalTestCase::assertIdentical(). The difference is that in your case the first argument is TRUE because you are just outputting the content of a variable, which never fails.

protected function assertIdentical($first, $second, $message = '', $group = 'Other') {
  return $this-&gt;assert($first === $second, $message ? $message : t('Value @first is identical to value @second.', array('@first' =&gt; var_export($first, TRUE), '@second' =&gt; var_export($second, TRUE))), $group);
}