diff --git a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
index 32aa058..3a2e5ff 100644
--- a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
+++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
@@ -20,7 +20,19 @@
  */
 class SimpletestPhpunitRunCommandTest extends UnitTestCase {
 
-  function testSimpletestPhpUnitRunCommand() {
+  /**
+   * Unique temporary id for each test.
+   *
+   * @var string
+   */
+  protected $tempName;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp();
+
     include_once __DIR__ .'/../../fixtures/simpletest_phpunit_run_command_test.php';
     $app_root = __DIR__ . '/../../../../../..';
     include_once "$app_root/core/modules/simpletest/simpletest.module";
@@ -30,13 +42,33 @@ function testSimpletestPhpUnitRunCommand() {
     $file_system->realpath('public://simpletest')->willReturn(sys_get_temp_dir());
     $container->set('file_system', $file_system->reveal());
     \Drupal::setContainer($container);
-    $test_id = basename(tempnam(sys_get_temp_dir(), 'xxx'));
-    foreach (['pass', 'fail'] as $status) {
-      putenv('SimpletestPhpunitRunCommandTestWillDie=' . $status);
-      $ret = simpletest_run_phpunit_tests($test_id, ['Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTestWillDie']);
-      $this->assertSame($ret[0]['status'], $status);
-    }
-    unlink(simpletest_phpunit_xml_filepath($test_id));
+
+    $this->tempName = basename(tempnam(sys_get_temp_dir(), 'xxx'));
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function tearDown() {
+    unlink(simpletest_phpunit_xml_filepath($this->tempName));
+    parent::tearDown();
+  }
+
+  /**
+   * Test simpletest pass and fail return.
+   *
+   * @dataProvider provideTestStatus
+   */
+  public function testSimpletestPhpUnitRunCommandPass($status) {
+    putenv('SimpletestPhpunitRunCommandTestWillDie=' . $status);
+    $ret = simpletest_run_phpunit_tests($this->tempName, ['Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTestWillDie']);
+    $this->assertSame($ret[0]['status'], $status);
   }
 
+  public function provideTestStatus() {
+    return [
+      ['pass'],
+      ['fail'],
+    ];
+  }
 }
