Having trouble POSTing value for a select element with SimpleTest I am trying to write a SimpleTest for a form that already exists. The form passes tests for GET, valid HTML and having the select element, which looks like this:

&lt;select id="edit-buid" name="buid" class="form-select"&gt;
  &lt;option value="1"&gt;New Business Unit&lt;/option&gt;
&lt;/select&gt;


The relevant code from my test case is:

$this-&gt;drupalGet('path/to/form');
$this-&gt;assertFieldByName('buid', NULL, 'form has buid field');

$edit = array(
  'buid' =&gt; 1,
);

$this-&gt;drupalPost('path/to/form', $edit, t('Save'));


I have tried passing the string "1" and array(1) and array("1") as well, but the test always fails with:

"Failed to set field buid to 1"

How can I make the test pass with the correct option selected?
After talking this through, I realized that I had not created the database records necessary to fill the select element in the test case. So, during the test, there actually was no &lt;option value="1"&gt;. The lesson is to think carefully about the entire context when writing test cases.