diff --git a/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php b/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php
index 9167501..39699a2 100644
--- a/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php
+++ b/core/modules/system/src/Tests/Form/ElementsTableSelectTest.php
@@ -220,9 +220,10 @@ private function formSubmitHelper($form, $edit) {
     $form_state->setUserInput($edit);
     $form_state->setFormObject(new StubForm($form_id, $form));

-    \Drupal::formBuilder()->prepareForm($form_id, $form, $form_state);
+    $formBuilder = \Drupal::formBuilder();
+    $formBuilder->prepareForm($form_id, $form, $form_state);

-    \Drupal::formBuilder()->processForm($form_id, $form, $form_state);
+    $formBuilder->processForm($form_id, $form, $form_state);

     $errors = $form_state->getErrors();

diff --git a/core/modules/system/src/Tests/Form/FormCacheTest.php b/core/modules/system/src/Tests/Form/FormCacheTest.php
index 2124404..185269b 100644
--- a/core/modules/system/src/Tests/Form/FormCacheTest.php
+++ b/core/modules/system/src/Tests/Form/FormCacheTest.php
@@ -41,6 +41,13 @@ class FormCacheTest extends DrupalUnitTestBase {
    */
   protected $form_state;

+  /**
+   * The form builder.
+   *
+   * @var \Drupal\Core\Form\FormBuilderInterface
+   */
+  protected $formBuilder;
+
   protected function setUp() {
     parent::setUp();
     $this->installSchema('system', array('key_value_expire'));
@@ -51,6 +58,7 @@ protected function setUp() {
     );
     $this->form_state = new FormState();
     $this->form_state->set('example', $this->randomMachineName());
+    $this->formBuilder = \Drupal->formBuilder();
   }

   /**
@@ -58,10 +66,10 @@ protected function setUp() {
    */
   function testCacheToken() {
     \Drupal::currentUser()->setAccount(new UserSession(array('uid' => 1)));
-    \Drupal::formBuilder()->setCache($this->form_build_id, $this->form, $this->form_state);
+    $this->formBuilder->setCache($this->form_build_id, $this->form, $this->form_state);

     $cached_form_state = new FormState();
-    $cached_form = \Drupal::formBuilder()->getCache($this->form_build_id, $cached_form_state);
+    $cached_form = $this->formBuilder->getCache($this->form_build_id, $cached_form_state);
     $this->assertEqual($this->form['#property'], $cached_form['#property']);
     $this->assertTrue(!empty($cached_form['#cache_token']), 'Form has a cache token');
     $this->assertEqual($this->form_state->get('example'), $cached_form_state->get('example'));
@@ -71,7 +79,7 @@ function testCacheToken() {
     // will break the parent site test runner batch.)
     \Drupal::state()->set('system.private_key', 'invalid');
     $cached_form_state = new FormState();
-    $cached_form = \Drupal::formBuilder()->getCache($this->form_build_id, $cached_form_state);
+    $cached_form = $this->formBuilder->getCache($this->form_build_id, $cached_form_state);
     $this->assertFalse($cached_form, 'No form returned from cache');
     $cached_form_state_example = $cached_form_state->get('example');
     $this->assertTrue(empty($cached_form_state_example));
@@ -79,7 +87,7 @@ function testCacheToken() {
     // Test that loading the cache with a different form_id fails.
     $wrong_form_build_id = $this->randomMachineName(9);
     $cached_form_state = new FormState();
-    $this->assertFalse(\Drupal::formBuilder()->getCache($wrong_form_build_id, $cached_form_state), 'No form returned from cache');
+    $this->assertFalse($this->formBuilder->getCache($wrong_form_build_id, $cached_form_state), 'No form returned from cache');
     $cached_form_state_example = $cached_form_state->get('example');
     $this->assertTrue(empty($cached_form_state_example), 'Cached form state was not loaded');
   }
@@ -91,10 +99,10 @@ function testNoCacheToken() {
     $this->container->set('current_user', new UserSession(array('uid' => 0)));

     $this->form_state->set('example', $this->randomMachineName());
-    \Drupal::formBuilder()->setCache($this->form_build_id, $this->form, $this->form_state);
+    $this->formBuilder->setCache($this->form_build_id, $this->form, $this->form_state);

     $cached_form_state = new FormState();
-    $cached_form = \Drupal::formBuilder()->getCache($this->form_build_id, $cached_form_state);
+    $cached_form = $this->formBuilder->getCache($this->form_build_id, $cached_form_state);
     $this->assertEqual($this->form['#property'], $cached_form['#property']);
     $this->assertTrue(empty($cached_form['#cache_token']), 'Form has no cache token');
     $this->assertEqual($this->form_state->get('example'), $cached_form_state->get('example'));
diff --git a/core/modules/system/src/Tests/Form/FormTest.php b/core/modules/system/src/Tests/Form/FormTest.php
index 22b3b84..41b68ba 100644
--- a/core/modules/system/src/Tests/Form/FormTest.php
+++ b/core/modules/system/src/Tests/Form/FormTest.php
@@ -28,6 +28,13 @@ class FormTest extends WebTestBase {
    */
   public static $modules = array('filter', 'form_test', 'file', 'datetime');

+  /*
+   * The form builder.
+   *
+   * @var \Drupal\Core\Form\FormBuilderInterface
+   */
+  protected $formBuilder;
+
   protected function setUp() {
     parent::setUp();

@@ -39,6 +46,8 @@ protected function setUp() {

     $filtered_html_permission = $filtered_html_format->getPermissionName();
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array($filtered_html_permission));
+
+    $this->formBuilder = \Drupal->formBuilder();
   }

   /**
@@ -116,8 +125,8 @@ function testRequiredFields() {
           // The form token CSRF protection should not interfere with this test,
           // so we bypass it by setting the token to FALSE.
           $form['#token'] = FALSE;
-          \Drupal::formBuilder()->prepareForm($form_id, $form, $form_state);
-          \Drupal::formBuilder()->processForm($form_id, $form, $form_state);
+          $this->formBuilder->prepareForm($form_id, $form, $form_state);
+          $this->formBuilder->processForm($form_id, $form, $form_state);
           $errors = $form_state->getErrors();
           // Form elements of type 'radios' throw all sorts of PHP notices
           // when you try to render them like this, so we ignore those for
@@ -165,7 +174,7 @@ function testRequiredFields() {
    * @see \Drupal\form_test\Form\FormTestValidateRequiredForm
    */
   function testRequiredCheckboxesRadio() {
-    $form = \Drupal::formBuilder()->getForm('\Drupal\form_test\Form\FormTestValidateRequiredForm');
+    $form = $this->formBuilder->getForm('\Drupal\form_test\Form\FormTestValidateRequiredForm');

     // Attempt to submit the form with no required fields set.
     $edit = array();
@@ -296,7 +305,7 @@ function testCheckboxProcessing() {
    * Tests validation of #type 'select' elements.
    */
   function testSelect() {
-    $form = \Drupal::formBuilder()->getForm('Drupal\form_test\Form\FormTestSelectForm');
+    $form = $this->formBuilder->getForm('Drupal\form_test\Form\FormTestSelectForm');
     $error = '!name field is required.';
     $this->drupalGet('form-test/select');

@@ -379,7 +388,7 @@ function testEmptySelect() {
    * Tests validation of #type 'number' and 'range' elements.
    */
   function testNumber() {
-    $form = \Drupal::formBuilder()->getForm('\Drupal\form_test\Form\FormTestNumberForm');
+    $form = $this->formBuilder->getForm('\Drupal\form_test\Form\FormTestNumberForm');

     // Array with all the error messages to be checked.
     $error_messages = array(
@@ -580,7 +589,7 @@ function assertFormValuesDefault($values, $form) {
    */
   function testDisabledMarkup() {
     $this->drupalGet('form-test/disabled-elements');
-    $form = \Drupal::formBuilder()->getForm('\Drupal\form_test\Form\FormTestDisabledElementsForm');
+    $form = $this->formBuilder->getForm('\Drupal\form_test\Form\FormTestDisabledElementsForm');
     $type_map = array(
       'textarea' => 'textarea',
       'select' => 'select',
diff --git a/core/modules/system/src/Tests/Form/ProgrammaticTest.php b/core/modules/system/src/Tests/Form/ProgrammaticTest.php
index ef8130c..75af379 100644
--- a/core/modules/system/src/Tests/Form/ProgrammaticTest.php
+++ b/core/modules/system/src/Tests/Form/ProgrammaticTest.php
@@ -24,6 +24,19 @@ class ProgrammaticTest extends WebTestBase {
    */
   public static $modules = array('form_test');

+  /*
+   * The form builder.
+   *
+   * @var \Drupal\Core\Form\FormBuilderInterface
+   */
+  protected $formBuilder;
+
+  protected function setUp() {
+    parent::setUp();
+
+    $this->formBuilder = \Drupal->formBuilder();
+  }
+
   /**
    * Test the programmatic form submission workflow.
    */
@@ -73,7 +86,7 @@ function testSubmissionWorkflow() {
   private function submitForm($values, $valid_input) {
     // Programmatically submit the given values.
     $form_state = (new FormState())->setValues($values);
-    \Drupal::formBuilder()->submitForm('\Drupal\form_test\Form\FormTestProgrammaticForm', $form_state);
+    $this->formBuilder->submitForm('\Drupal\form_test\Form\FormTestProgrammaticForm', $form_state);

     // Check that the form returns an error when expected, and vice versa.
     $errors = $form_state->getErrors();
@@ -106,7 +119,7 @@ public function testProgrammaticAccessBypass() {
     // Programmatically submit the form with a value for the restricted field.
     // Since programmed_bypass_access_check is set to TRUE by default, the
     // field is accessible and can be set.
-    \Drupal::formBuilder()->submitForm('\Drupal\form_test\Form\FormTestProgrammaticForm', $form_state);
+    $this->formBuilder->submitForm('\Drupal\form_test\Form\FormTestProgrammaticForm', $form_state);
     $values = $form_state->get('programmatic_form_submit');
     $this->assertEqual($values['field_restricted'], 'dummy value', 'The value for the restricted field is stored correctly.');

@@ -115,7 +128,7 @@ public function testProgrammaticAccessBypass() {
     // restrictions apply, the restricted field is inaccessible, and the value
     // should not be stored.
     $form_state->setProgrammedBypassAccessCheck(FALSE);
-    \Drupal::formBuilder()->submitForm('\Drupal\form_test\Form\FormTestProgrammaticForm', $form_state);
+    $this->formBuilder->submitForm('\Drupal\form_test\Form\FormTestProgrammaticForm', $form_state);
     $values = $form_state->get('programmatic_form_submit');
     $this->assertNotEqual($values['field_restricted'], 'dummy value', 'The value for the restricted field is not stored.');

