diff --git a/core/modules/block/src/Tests/BlockHookOperationTest.php b/core/modules/block/src/Tests/BlockHookOperationTest.php
index c83882c..2f4f319 100644
--- a/core/modules/block/src/Tests/BlockHookOperationTest.php
+++ b/core/modules/block/src/Tests/BlockHookOperationTest.php
@@ -9,7 +9,6 @@
 
 namespace Drupal\block\Tests;
 
-use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -44,7 +43,7 @@ protected function setUp() {
   public function testBlockOperationAlter() {
     // Add a test block, any block will do.
     // Set the machine name so the test_operation link can be built later.
-    $block_id = Unicode::strtolower($this->randomMachineName(16));
+    $block_id = $this->randomLowercaseMachineName(16);
     $this->drupalPlaceBlock('system_powered_by_block', array('id' => $block_id));
 
     // Get the Block listing.
diff --git a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
index d17fc3b..f934cc9 100644
--- a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
+++ b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\block_content\Tests;
 
-use Drupal\Component\Utility\Unicode;
 use Drupal\content_translation\Tests\ContentTranslationUITestBase;
 
 /**
@@ -94,7 +93,7 @@ protected function createBlockContent($title = FALSE, $bundle = FALSE) {
    * Overrides \Drupal\content_translation\Tests\ContentTranslationUITestBase::getNewEntityValues().
    */
   protected function getNewEntityValues($langcode) {
-    return array('info' => Unicode::strtolower($this->randomMachineName())) + parent::getNewEntityValues($langcode);
+    return ['info' => $this->randomLowercaseMachineName()] + parent::getNewEntityValues($langcode);
   }
 
   /**
diff --git a/core/modules/block_content/src/Tests/PageEditTest.php b/core/modules/block_content/src/Tests/PageEditTest.php
index fdd1743..7bb2712 100644
--- a/core/modules/block_content/src/Tests/PageEditTest.php
+++ b/core/modules/block_content/src/Tests/PageEditTest.php
@@ -8,7 +8,6 @@
 namespace Drupal\block_content\Tests;
 
 use Drupal\block_content\Entity\BlockContent;
-use Drupal\Component\Utility\Unicode;
 
 /**
  * Create a block and test block edit functionality.
@@ -27,7 +26,7 @@ public function testPageEdit() {
     $body_key = 'body[0][value]';
     // Create block to edit.
     $edit = array();
-    $edit['info[0][value]'] = Unicode::strtolower($this->randomMachineName(8));
+    $edit['info[0][value]'] = $this->randomLowercaseMachineName();
     $edit[$body_key] = $this->randomMachineName(16);
     $this->drupalPostForm('block/add/basic', $edit, t('Save'));
 
diff --git a/core/modules/config/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php
index 6a63df7..bb39faf 100644
--- a/core/modules/config/src/Tests/ConfigExportImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\config\Tests;
 
-use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Archiver\ArchiveTar;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -107,7 +106,7 @@ public function testExportImport() {
     $this->contentType = $this->drupalCreateContentType();
 
     // Create a field.
-    $this->fieldName = Unicode::strtolower($this->randomMachineName());
+    $this->fieldName = $this->randomLowercaseMachineName();
     $this->fieldStorage = entity_create('field_storage_config', array(
       'field_name' => $this->fieldName,
       'entity_type' => 'node',
diff --git a/core/modules/config/src/Tests/ConfigImportRecreateTest.php b/core/modules/config/src/Tests/ConfigImportRecreateTest.php
index 83ea2ee..705060b 100644
--- a/core/modules/config/src/Tests/ConfigImportRecreateTest.php
+++ b/core/modules/config/src/Tests/ConfigImportRecreateTest.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\config\Tests;
 
-use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Config\ConfigImporter;
 use Drupal\Core\Config\StorageComparer;
 use Drupal\node\Entity\NodeType;
@@ -62,7 +61,7 @@ protected function setUp() {
   }
 
   public function testRecreateEntity() {
-    $type_name = Unicode::strtolower($this->randomMachineName(16));
+    $type_name = $this->randomLowercaseMachineName(16);
     $content_type = entity_create('node_type', array(
       'type' => $type_name,
       'name' => 'Node type one',
diff --git a/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
index 118c1cb..2f5ecd6 100644
--- a/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
+++ b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
@@ -8,7 +8,6 @@
 namespace Drupal\config\Tests;
 
 use Drupal\Component\Utility\SafeMarkup;
-use Drupal\Component\Utility\Unicode;
 use Drupal\Component\Uuid\Php;
 use Drupal\Core\Config\ConfigImporter;
 use Drupal\Core\Config\ConfigImporterException;
@@ -86,7 +85,7 @@ public function testRenameValidation() {
 
     // Create a content type with a matching UUID in the active storage.
     $content_type = entity_create('node_type', array(
-      'type' => Unicode::strtolower($this->randomMachineName(16)),
+      'type' => $this->randomLowercaseMachineName(16),
       'name' => $this->randomMachineName(),
       'uuid' => $uuid,
     ));
diff --git a/core/modules/field/src/Tests/Number/NumberFieldTest.php b/core/modules/field/src/Tests/Number/NumberFieldTest.php
index a3226a9..d541796 100644
--- a/core/modules/field/src/Tests/Number/NumberFieldTest.php
+++ b/core/modules/field/src/Tests/Number/NumberFieldTest.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\field\Tests\Number;
 
-use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -42,7 +41,7 @@ protected function setUp() {
    */
   function testNumberDecimalField() {
     // Create a field with settings to validate.
-    $field_name = Unicode::strtolower($this->randomMachineName());
+    $field_name = $this->randomLowercaseMachineName();
     entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -132,7 +131,7 @@ function testNumberIntegerField() {
     $maximum = rand(2000, 4000);
 
     // Create a field with settings to validate.
-    $field_name = Unicode::strtolower($this->randomMachineName());
+    $field_name = $this->randomLowercaseMachineName();
     $storage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -242,7 +241,7 @@ function testNumberIntegerField() {
   */
   function testNumberFloatField() {
     // Create a field with settings to validate.
-    $field_name = Unicode::strtolower($this->randomMachineName());
+    $field_name = $this->randomLowercaseMachineName();
     entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -331,9 +330,9 @@ function testNumberFloatField() {
    * Test default formatter behavior
    */
   function testNumberFormatter() {
-    $type = Unicode::strtolower($this->randomMachineName());
-    $float_field = Unicode::strtolower($this->randomMachineName());
-    $integer_field = Unicode::strtolower($this->randomMachineName());
+    $type = $this->randomLowercaseMachineName();
+    $float_field = $this->randomLowercaseMachineName();
+    $integer_field = $this->randomLowercaseMachineName();
     $thousand_separators = array('', '.', ',', ' ', chr(8201), "'");
     $decimal_separators = array('.', ',');
     $prefix = $this->randomMachineName();
@@ -467,7 +466,7 @@ function testNumberFormatter() {
    */
   function testCreateNumberFloatField() {
     // Create a float field.
-    $field_name = Unicode::strtolower($this->randomMachineName());
+    $field_name = $this->randomLowercaseMachineName();
     entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -492,7 +491,7 @@ function testCreateNumberFloatField() {
    */
   function testCreateNumberDecimalField() {
     // Create a decimal field.
-    $field_name = Unicode::strtolower($this->randomMachineName());
+    $field_name = $this->randomLowercaseMachineName();
     entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
diff --git a/core/modules/simpletest/src/RandomGeneratorTrait.php b/core/modules/simpletest/src/RandomGeneratorTrait.php
index 70087ce..67a663e 100644
--- a/core/modules/simpletest/src/RandomGeneratorTrait.php
+++ b/core/modules/simpletest/src/RandomGeneratorTrait.php
@@ -8,6 +8,7 @@
 namespace Drupal\simpletest;
 
 use Drupal\Component\Utility\Random;
+use Drupal\Component\Utility\Unicode;
 
 /**
  * Provides random generator utility methods.
@@ -89,14 +90,36 @@ public function randomStringValidate($string) {
    *
    * @param int $length
    *   Length of random string to generate.
+   * @param bool $lowercase
+   *   (optional) If the generated machine name is forced to lowercase. Defaults
+   *   to FALSE.
    *
    * @return string
    *   Randomly generated unique string.
    *
    * @see \Drupal\Component\Utility\Random::name()
    */
-  protected function randomMachineName($length = 8) {
-    return $this->getRandomGenerator()->name($length, TRUE);
+  protected function randomMachineName($length = 8, $lowercase = FALSE) {
+    $machine_name = $this->getRandomGenerator()->name($length, TRUE);
+    return $lowercase ? Unicode::strtolower($machine_name) : $machine_name;
+  }
+
+  /**
+   * Generates a unique lowercase random string containing letters and numbers.
+   *
+   * Do not use this method when testing unvalidated user input. Instead, use
+   * \Drupal\simpletest\TestBase::randomString().
+   *
+   * @param int $length
+   *   Length of random string to generate.
+   *
+   * @return string
+   *   Randomly generated unique string.
+   *
+   * @see \Drupal\simpletest\RandomGeneratorTrait::randomMachineName()
+   */
+  protected function randomLowercaseMachineName($length = 8) {
+    return $this->randomMachineName($length, TRUE);
   }
 
   /**
diff --git a/core/modules/system/src/Tests/System/DateFormatsMachineNameTest.php b/core/modules/system/src/Tests/System/DateFormatsMachineNameTest.php
index a273515..f06f3f7 100644
--- a/core/modules/system/src/Tests/System/DateFormatsMachineNameTest.php
+++ b/core/modules/system/src/Tests/System/DateFormatsMachineNameTest.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\system\Tests\System;
 
-use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -61,7 +60,7 @@ public function testDateFormatsMachineNameAllowedValues() {
     $this->assertText(t('The machine-readable name is already in use. It must be unique.'), 'It is not possible to create a date format with the machine name "fallback". It is a built-in format that already exists.');
 
     // Create a date format with a machine name distinct from the previous two.
-    $id = Unicode::strtolower($this->randomMachineName(16));
+    $id = $this->randomLowercaseMachineName(16);
     $edit = array(
       'label' => $this->randomMachineName(16),
       'id' => $id,
diff --git a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
index e8a7c1b..d11f293 100644
--- a/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
+++ b/core/modules/views/src/Tests/Entity/ViewEntityDependenciesTest.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\views\Tests\Entity;
 
-use Drupal\Component\Utility\Unicode;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\views\Tests\ViewTestData;
 use Drupal\views\Tests\ViewKernelTestBase;
@@ -58,7 +57,7 @@ protected function setUp() {
     ));
     $content_type->save();
     $field_storage = entity_create('field_storage_config', array(
-      'field_name' => Unicode::strtolower($this->randomMachineName()),
+      'field_name' => $this->randomLowercaseMachineName(),
       'entity_type' => 'node',
       'type' => 'comment',
     ));
