diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index a4c7b27..d0be97e 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -1267,7 +1267,7 @@ protected function parse() {
       $htmlDom = new \DOMDocument();
       @$htmlDom->loadHTML('<?xml encoding="UTF-8">' . $this->drupalGetContent());
       if ($htmlDom) {
-        $this->pass(t('Valid HTML found on "@path"', array('@path' => $this->getUrl())), t('Browser'));
+        $this->pass(String::format('Valid HTML found on "@path"', array('@path' => $this->getUrl())), 'Browser');
         // It's much easier to work with simplexml than DOM, luckily enough
         // we can just simply import our DOM tree.
         $this->elements = simplexml_import_dom($htmlDom);
@@ -2919,16 +2919,17 @@ protected function assertFieldByXPath($xpath, $value = NULL, $message = '', $gro
           }
           elseif (isset($field->option)) {
             // Select element found.
-            if ($this->getSelectedItem($field) == $value) {
-              $found = TRUE;
-            }
-            else {
+            $selected = $this->getSelectedItem($field);
+            if ($selected === FALSE) {
               // No item selected so use first item.
               $items = $this->getAllOptions($field);
               if (!empty($items) && $items[0]['value'] == $value) {
                 $found = TRUE;
               }
             }
+            elseif ($selected == $value) {
+              $found = TRUE;
+            }
           }
           elseif ((string) $field == $value) {
             // Text area with correct text.
diff --git a/core/modules/simpletest/tests/Drupal/simpletest/Tests/Fixtures/select_2nd_selected.html b/core/modules/simpletest/tests/Drupal/simpletest/Tests/Fixtures/select_2nd_selected.html
new file mode 100644
index 0000000..ec30bd6
--- /dev/null
+++ b/core/modules/simpletest/tests/Drupal/simpletest/Tests/Fixtures/select_2nd_selected.html
@@ -0,0 +1,4 @@
+<select name="test">
+  <option value="1">One</option>
+  <option value="2" selected="selected">Two</option>
+</select>
diff --git a/core/modules/simpletest/tests/Drupal/simpletest/Tests/Fixtures/select_none_selected.html b/core/modules/simpletest/tests/Drupal/simpletest/Tests/Fixtures/select_none_selected.html
new file mode 100644
index 0000000..a6c8749
--- /dev/null
+++ b/core/modules/simpletest/tests/Drupal/simpletest/Tests/Fixtures/select_none_selected.html
@@ -0,0 +1,4 @@
+<select name="test">
+  <option value="1">One</option>
+  <option value="2">Two</option>
+</select>
diff --git a/core/modules/simpletest/tests/Drupal/simpletest/Tests/WebTestBaseTest.php b/core/modules/simpletest/tests/Drupal/simpletest/Tests/WebTestBaseTest.php
new file mode 100644
index 0000000..1cf0600
--- /dev/null
+++ b/core/modules/simpletest/tests/Drupal/simpletest/Tests/WebTestBaseTest.php
@@ -0,0 +1,87 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\simpletest\Tests\WebTestBaseTest.
+ */
+
+namespace Drupal\simpletest\Tests;
+
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * Tests helper methods provided by the abstract WebTestBase class.
+ *
+ * @group Drupal
+ * @group Simpletest
+ */
+class WebTestBaseTest extends UnitTestCase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    return array(
+      'name' => 'WebTestBase helper functions test',
+      'description' => 'Test helper functions provided by the WebTestBase abstract class.',
+      'group' => 'Simpletest',
+    );
+  }
+
+  /**
+   * Provides data for testing the assertFieldByName() helper.
+   *
+   * @return array
+   *   An array of values passed to the test method.
+   */
+  public function providerAssertFieldByName() {
+    $data = array();
+    $data[] = array('select_2nd_selected', 'test', '1', FALSE);
+    $data[] = array('select_2nd_selected', 'test', '2', TRUE);
+    $data[] = array('select_none_selected', 'test', '', FALSE);
+    $data[] = array('select_none_selected', 'test', '1', TRUE);
+    $data[] = array('select_none_selected', 'test', NULL, TRUE);
+
+    return $data;
+  }
+
+  /**
+   * Tests the assertFieldByName() helper.
+   *
+   * @param string $filename
+   *   Name of file containing the output to test.
+   * @param string $name
+   *   Name of field to assert.
+   * @param string $value
+   *   Value of the field to assert.
+   * @param bool $expected
+   *   The expected result of the assert.
+   *
+   * @see \Drupal\simpletest\WebTestBase::assertFieldByName().
+   *
+   * @dataProvider providerAssertFieldByName
+   */
+  public function testAssertFieldByName($filename, $name, $value, $expected) {
+    $content = file_get_contents(__DIR__ . '/Fixtures/' . $filename . '.html');
+
+    $web_test = $this->getMockBuilder('Drupal\simpletest\WebTestBase')
+      ->disableOriginalConstructor()
+      ->setMethods(array('assertTrue', 'drupalGetContent', 'pass'))
+      ->getMock();
+
+    $web_test->expects($this->any())
+      ->method('drupalGetContent')
+      ->will($this->returnValue($content));
+
+    $web_test->expects($this->once())
+      ->method('assertTrue')
+      ->with($this->identicalTo($expected),
+             $this->identicalTo('message'),
+             $this->identicalTo('Browser'));
+
+    $test_method = new \ReflectionMethod('Drupal\simpletest\WebTestBase', 'assertFieldByName');
+    $test_method->setAccessible(TRUE);
+    $test_method->invokeArgs($web_test, array($name, $value, 'message'));
+  }
+
+}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
index 18e2184..023a6e4 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php
@@ -87,7 +87,7 @@ function testTaxonomyTermFieldMultipleVocabularies() {
 
     // Submit an entity with both terms.
     $this->drupalGet('entity_test/add');
-    $this->assertFieldByName("{$this->field_name}[]", '', 'Widget is displayed');
+    $this->assertFieldByName("{$this->field_name}[]", NULL, 'Widget is displayed');
     $edit = array(
       'user_id' => mt_rand(0, 10),
       'name' => $this->randomName(),
@@ -130,7 +130,7 @@ function testTaxonomyTermFieldMultipleVocabularies() {
 
     // The widget should still be displayed.
     $this->drupalGet('entity_test/add');
-    $this->assertFieldByName("{$this->field_name}[]", '', 'Widget is still displayed');
+    $this->assertFieldByName("{$this->field_name}[]", NULL, 'Widget is still displayed');
 
     // Term 1 should still pass validation.
     $edit = array(
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
index d289a2c..889058d 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php
@@ -102,7 +102,7 @@ function testTaxonomyTermFieldWidgets() {
 
     // Display creation form.
     $this->drupalGet('entity_test/add');
-    $this->assertFieldByName($this->field_name, '', 'Widget is displayed.');
+    $this->assertFieldByName($this->field_name, NULL, 'Widget is displayed.');
 
     // Submit with some value.
     $edit = array(
