Using variable_get from DrupalWebTestCase I would like to pull certain configuration items from settings.php from a DrupalWebTestCase in order to test my module (in this case, a SFTP module).
I want to do it this way so that I don't hardcode my SFTP credentials.

For example, in my DrupalWebTestCase, I have:

  public function test_sftp()
  {
    $this-&gt;assertTrue(variable_get('mymodule_test_sftp'));
    // then I would try to connect, etc....
  }


In settings.php:

$conf['mymodule_test_sftp'] = array(
 'host' =&gt; 'example.com',
 // etc...
);


When I run the unit testing suite, this unit test fails, the value returned by variable_get is NULL.

Edit:

Running the code below, returns the correct database settings, but I get "Undefined index: mymodule_test_sftp": 

  public function test_sftp()
  {
    global $databases, $conf;
    $this-&gt;assertTrue($databases);
    $this-&gt;assertTrue($conf['mymodule_test_sftp']);
  }
Just faced a similar issue. What I have found out is that in your DrupalWebTestCase child class you still have access to all variables defined in settings.php before calling parent::setUp(). Which means you can do something like this:

class MymoduleWebTestCase extends DrupalWebTestCase {

  public function setUp() {
    $mymodule_test_sftp = variable_get('mymodule_test_sftp');

    parent::setUp();

    variable_set('mymodule_test_sftp', $mymodule_test_sftp);
  }

}