0

I have created a test orb.test for my module and placed it within the module directory. Installed the Simple Test module. When I visit the /admin/config/development/testing my test orb.test its not listed. Here is the code for my test

class OrbTestCase extends DrupalWebTestCase {
  protected $privileged_user;


public static function getInfo() {
  return array(
    'name' => 'Orb Test Case',
    'description' => 'Ensure that Online Booking functions properly',
    'group' => 'Examples',
  );
}

public function setUp() {
    parent::setUp('orb');
    $this->privileged_user = $this->drupalCreateUser(array('allow online  reservations'));
    $this->drupalLogin($this->privileged_user);
}

public function testorbroomavailability() {
  $this->drupalGet('orb');
  $this->assertText('Room Status');
}
}

Have I missed something here?

EDIT 5th August 2014: My tests written and placed in of my modules do not show up in the list of tests (admin/config/development/testing)

7
  • Yes U have. I use the devel module to install and reinstall the module. Commented Apr 28, 2014 at 11:28
  • How is your test file named? Where is it exactly placed?
    – sanzante
    Commented Apr 28, 2014 at 11:45
  • "Have I missed something here?" Well there is a lot of stuff you do not tell us. Without knowing exactly what you've done, it is impossible to tell what you've missed. Commented Apr 28, 2014 at 11:59
  • @tunic mymodule.test placed in the module folder. Commented Apr 28, 2014 at 12:41
  • I think Free Radical's answer is absolutekly right, some of the points he talks must be failing in your setup.
    – sanzante
    Commented Apr 28, 2014 at 12:49

1 Answer 1

1

Your test class look OK.

There is no need to install or enable the Simple test module if you're using Drupal 7. Instead, you should enable the core Testing module. (Don't know if installing Simple test will make a difference, but it were not present when I went through the routine described below.)

Provided it exists inside your module's directory, you're using Drupal 7, have enabled the core Testing module, cleared the cache, and made sure to declare your test file with the correct name in your module's .info-file, nothing should stop it from appearing in the list included in the "Examples" group when you visit /admin/config/development/testing.

Here is how it looks on my site (after I've gone through the steps outlined above):

screen dump

4
  • Nope. Done all that you have mentioned. Doesn't show the test group :-( Commented Apr 28, 2014 at 12:45
  • There is no "test" group. You're placing it in the "Examples" group. Have you looked there? Commented Apr 28, 2014 at 14:35
  • my issue seems stranger the fiction! I have removed the examples module from my laptop, cleared caches but it still appears in the list of tests. So it seems like a cache issue. For some reason it doesn't seem to be updating the list. I am using drupal 7.22 At one point I had a doubt if I was copying the module to the correct VHOST directory, which I definitely was. Very strange behaviour. Commented Apr 29, 2014 at 7:48
  • 1
    My module.info file was missing this line "testing_api = 2.x" and hence was not not showing up. Commented Aug 5, 2014 at 6:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.