I'm trying to build a simple test. I'm having trouble submitting webforms. With [help form a previous question](https://drupal.stackexchange.com/a/150294/5966) I've cobbled together these functions within the larger class. 

They completely work in the following test.php script run on the command line via `drush scr test.php`

```
$data = array(
  1 => array('1'),
  2 => array('2'),
  3 => array('3')
);

$T = new MyTest();
$T->insertMockData($data);

```

However, when I try to run as `drush test-run MyTest things fail completely.

Source snippet: 

```
  function setUp($modules = array()) {
        $modules[] = 'webform';
        parent::setUp($modules);

        $this->insertMockData($this->randomData());
    }
function insertMockData($data = array(), $submitted_datetime = REQUEST_TIME) {

        $node_web = node_load(1);
        $submission = (object) array(
        'nid' => $node_web->nid,
        //'uid' => $user->uid,
        'submitted' => $submitted_datetime,
        'remote_addr' => ip_address(),
        'is_draft' => FALSE,
        'data' => $data,
            'serial' => $this->serial_value++,
        );
        module_load_include('inc', 'webform', 'includes/webform.submissions');
        webform_submission_insert($node_web, $submission);
            //webform_submission_send_mail($node_web, $submission);
          }

    function randomData() {
    $random_line_of_text  = array(
      "Mary had a little lamb",
      "a little lamb",
      "With fleece as white as snow",
      "And everywhere that Mary went",
      "That lamb was sure to go");

    return array(
      1 => array($random_line_of_text[array_rand($random_line_of_text)]),
      2 => array($random_line_of_text[array_rand($random_line_of_text)]),
      3 => array($random_line_of_text[array_rand($random_line_of_text)]),
    );
}

```

Errors on console 

```
Test MyTest->insertMockData() failed: Trying to get property of non-object                       [error] Test webform_webform_submission_presave() failed: Trying to get property of non-object             [error] 
Test webform_webform_submission_presave() failed: Invalid argument supplied for foreach()          [error] Test webform_submission_insert() failed: Trying to get property of non-object                      [error] 
Test webform_submission_insert() failed: Trying to get property of non-object                      [error] Test webform_submission_insert() failed: Trying to get property of non-object                      [error] 
Test webform_submission_insert() failed: Trying to get property of non-object                      [error] Test webform_submission_send_mail() failed: Trying to get property of non-object                   [error] 
Test webform_submission_send_mail() failed: Invalid argument supplied for foreach()                [error] Test MyTest->insertMockData() failed: Trying to get property of non-object                       [error] 

```

**Question: How do I debug a the output of SimpleTest when I'm not sure where in the script the error occurred?**