diff --git a/core/modules/hal/src/Tests/NormalizeTest.php b/core/modules/hal/src/Tests/NormalizeTest.php
index b73d4b7..5fca46c 100644
--- a/core/modules/hal/src/Tests/NormalizeTest.php
+++ b/core/modules/hal/src/Tests/NormalizeTest.php
@@ -9,7 +9,6 @@
 
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Url;
-use Drupal\entity_test\Entity\EntityTest;
 
 /**
  * Tests that entities can be normalized in HAL.
diff --git a/core/modules/simpletest/src/BrowserTestBase.php b/core/modules/simpletest/src/BrowserTestBase.php
index dc933ac..bcc3cd5 100644
--- a/core/modules/simpletest/src/BrowserTestBase.php
+++ b/core/modules/simpletest/src/BrowserTestBase.php
@@ -11,6 +11,7 @@
 use Behat\Mink\Element\Element;
 use Behat\Mink\Mink;
 use Behat\Mink\Session;
+use Drupal\Component\Utility\Html;
 use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Component\Utility\UrlHelper;
 use Drupal\Core\Cache\Cache;
@@ -226,6 +227,41 @@
   protected $preserveGlobalState = FALSE;
 
   /**
+   * Class name for verbose logging.
+   *
+   * @var string
+   */
+  protected $verboseClassName;
+
+  /**
+   * Directory name for verbose logging.
+   *
+   * @var string
+   */
+  protected $verboseDirectory;
+
+  /**
+   * Counter storage for verbose logging.
+   *
+   * @var string
+   */
+  protected $verboseCounterStorage;
+
+  /**
+   * Counter for verbose logging.
+   *
+   * @var int
+   */
+  protected $verboseCounter = 1;
+
+  /**
+   * Verbose output enabled.
+   *
+   * @var bool
+   */
+  protected $verboseOutput = FALSE;
+
+  /**
    * Initializes Mink sessions.
    */
   protected function initMink() {
@@ -367,6 +403,15 @@ protected function setUp() {
         }
       }
     }
+
+    $verbose_directory = getenv('SIMPLETEST_VERBOSE_DIRECTORY');
+    $this->verboseOutput = (bool) $verbose_directory;
+    $this->verboseClassName = str_replace("\\", "_", get_called_class());
+    $this->verboseDirectory = rtrim($verbose_directory, '/');
+    $this->verboseCounterStorage = $this->verboseDirectory . '/' . $this->verboseClassName . '.counter';
+    if (is_file($this->verboseCounterStorage)) {
+      $this->verboseCounter = max(1, (int) file_get_contents($this->verboseCounterStorage));
+    }
   }
 
   /**
@@ -505,6 +550,14 @@ protected function drupalGet($path, array $options = array()) {
     // Ensure that any changes to variables in the other thread are picked up.
     $this->refreshVariables();
 
+    if ($this->verboseOutput) {
+      $verbose = 'GET request to: ' . $url .
+        '<hr />Ending URL: ' . $this->getSession()->getCurrentUrl();
+      $verbose .= '<hr />' . $out;
+      $verbose .= $this->getVerboseHeaders();
+      $this->verbose($verbose);
+    }
+
     return $out;
   }
 
@@ -770,10 +823,12 @@ protected function submitForm(array $edit, $submit, $form_html_id = NULL) {
     if (isset($form_html_id)) {
       $form = $assert_session->elementExists('xpath', "//form[@id='$form_html_id']");
       $submit_button = $assert_session->buttonExists($submit, $form);
+      $action = $form->getAttribute('action');
     }
     else {
       $submit_button = $assert_session->buttonExists($submit);
       $form = $assert_session->elementExists('xpath', './ancestor::form', $submit_button);
+      $action = $form->getAttribute('action');
     }
 
     // Edit the form values.
@@ -788,6 +843,14 @@ protected function submitForm(array $edit, $submit, $form_html_id = NULL) {
 
     // Ensure that any changes to variables in the other thread are picked up.
     $this->refreshVariables();
+    if ($this->verboseOutput) {
+      $out = $this->getSession()->getPage()->getContent();
+      $verbose = 'POST request to: ' . $action .
+        '<hr />Ending URL: ' . $this->getSession()->getCurrentUrl();
+      $verbose .= '<hr />' . $out;
+      $verbose .= $this->getVerboseHeaders();
+      $this->verbose($verbose);
+    }
   }
 
   /**
@@ -1353,4 +1416,36 @@ public function __sleep() {
     return [];
   }
 
+  /**
+   * Logs a verbose message in a text file.
+   *
+   * The link to the verbose message will be printed by the results printer.
+   *
+   * @param string $message
+   *   The verbose message to be stored.
+   *
+   * @see \Drupal\Tests\Listeners\VerbosePrinter::printResult()
+   */
+  protected function verbose($message) {
+    if (!$this->verboseOutput) {
+      return;
+    }
+    $message = '<hr />ID #' . $this->verboseCounter . ' (<a href="' . $this->verboseClassName . '-' . ($this->verboseCounter - 1) . '.html">Previous</a> | <a href="' . $this->verboseClassName . '-' . ($this->verboseCounter + 1) . '.html">Next</a>)<hr />' . $message;
+    $verbose_filename = $this->verboseClassName . '-' . $this->verboseCounter . '.html';
+    file_put_contents($this->verboseDirectory . '/' . $verbose_filename, $message);
+    file_put_contents($this->verboseCounterStorage, $this->verboseCounter++);
+  }
+
+  /**
+   * Returns headers in verbose format.
+   *
+   * @return string
+   *   Verbose headers.
+   */
+  protected function getVerboseHeaders() {
+    return '<hr />Headers: <pre>' . Html::escape(var_export(array_map(function($headers) {
+      return implode(';', array_map('trim', $headers));
+    }, $this->getSession()->getResponseHeaders()), TRUE)) . '</pre>';
+  }
+
 }
diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist
index 2620fe9..a1202ef 100644
--- a/core/phpunit.xml.dist
+++ b/core/phpunit.xml.dist
@@ -5,7 +5,8 @@
          beStrictAboutTestsThatDoNotTestAnything="true"
          beStrictAboutOutputDuringTests="true"
          beStrictAboutChangesToGlobalState="true"
-         checkForUnintentionallyCoveredCode="false">
+         checkForUnintentionallyCoveredCode="false"
+         printerClass="\Drupal\Tests\Listeners\VerbosePrinter">
   <php>
     <!-- Set error reporting to E_ALL. -->
     <ini name="error_reporting" value="32767"/>
diff --git a/core/tests/Drupal/Tests/Listeners/VerbosePrinter.php b/core/tests/Drupal/Tests/Listeners/VerbosePrinter.php
new file mode 100644
index 0000000..ea3483b
--- /dev/null
+++ b/core/tests/Drupal/Tests/Listeners/VerbosePrinter.php
@@ -0,0 +1,98 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\Tests\Listeners\VerbosePrinter.
+ */
+
+namespace Drupal\Tests\Listeners;
+
+/**
+ * Defines a class for providing verbose results for verbose aware tests.
+ */
+class VerbosePrinter extends \PHPUnit_TextUI_ResultPrinter {
+
+  protected $directory;
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct($out, $verbose, $colors, $debug, $numberOfColumns) {
+    parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns);
+    if ($verbose_directory = getenv('SIMPLETEST_VERBOSE_DIRECTORY')) {
+      // Initialize verbose debugging.
+      $this->directory = rtrim($verbose_directory, '/');
+      // Check if directory exists.
+      if (is_dir($this->directory)) {
+        // Remove it.
+        $this->cleanUpLastTestRun($this->directory);
+      }
+      // Create the directory.
+      if (mkdir($this->directory, 0775)) {
+        if (is_writable($this->directory)) {
+          chmod($this->directory, 0775);
+        }
+        file_put_contents($this->directory . '/.htaccess', "<IfModule mod_expires.c>\nExpiresActive Off\n</IfModule>\n");
+      }
+      else {
+        $this->writeWithColor('bg-red, fg-black', "Verbose directory {$this->directory} could not be created.");
+        $this->directory = NULL;
+      }
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function printResult(\PHPUnit_Framework_TestResult $result) {
+    parent::printResult($result);
+
+    if (!$this->directory) {
+      $this->writeWithColor('bg-yellow, fg-black', 'No verbose output was generated');
+      $this->writeNewLine();
+      $this->write('To generate verbose output for functional tests, set the SIMPLETEST_VERBOSE_DIRECTORY environment variable.');
+      $this->writeNewLine();
+      $this->write('e.g export SIMPLETEST_VERBOSE_DIRECTORY="/path/to/webroot/sites/default/files/simpletest/verbose".');
+      $this->writeNewLine();
+      return;
+    }
+
+    $counter = 0;
+    foreach (glob($this->directory . '/*.html') as $filename) {
+      if (!$counter) {
+        $this->writeNewLine();
+        $this->writeWithColor('bg-yellow, fg-black', 'Verbose Output was generated');
+      }
+      $this->write($filename);
+      $this->writeNewLine();
+      $counter++;
+    }
+    if ($counter) {
+      $this->writeWithColor('bg-yellow, fg-black', sprintf('%d verbose files', $counter));
+    }
+  }
+
+  /**
+   * Cleans up last run.
+   *
+   * @param string $directory
+   *   Directory to remove.
+   */
+  protected function cleanUpLastTestRun($directory) {
+    if (isset($directory) && is_dir($directory)) {
+      $objects = scandir($directory);
+      foreach ($objects as $object) {
+        if ($object !== "." && $object !== "..") {
+          $filename = $directory . "/" . $object;
+          if (filetype($filename) == "directory") {
+            $this->cleanUpLastTestRun($filename);
+          }
+          else {
+            unlink($filename);
+          }
+        }
+      }
+      reset($objects);
+      rmdir($directory);
+    }
+  }
+
+}
