I am using Drupal 7, and the latest version of the Simpletest module. I have written a test case like the following one:

class SimpleTestDemoTestCase extends DrupalWebTestCase {
  function setUp($modules = array()) {

  public function getInfo(){
    return array(
      'name' => 'Simpletestdemo testcase',
      'description' => 'Simpletestdemo testcase desc',
      'group' => 'Simpletestdemo'

  public function testBlockView() {
    $simpletestblockview = module_invoke('simpletestdemo','block_view);
    $this->assertTrue(t('Simpletest Demo'),$simpletestblockview['title']);

This does not get recognized by the Simpletest module. Is there anything wrong in this test case?

  • did you include this file in .info files[] ? – Srihitha Narra Oct 3 '11 at 12:56

As srihita pointed out in a comment, you need to add the file which contains the test class to the files[] array in your module's info file like this:


Then, let it rebuild by submitting the modules page or use the "Clear information" (or similar, not sure about the exact label right now) at the bottom of the Testing page.

Also, you're code is missing a ', but that might be a copy/paste error.

| improve this answer | |
  • 1
    Saw this question when looking for a related problem. For the next person looking for an answer: If the simpletest contributed module (version 2.x) is installed and enabled (as opposed to the D7 simpletest core module), you need to add the testing_api = 2.x to the module.info file, otherwise simpletest will not recognize your test. – Ursula Nov 26 '13 at 2:41

I am also facing same problem.

The test case is not recognized by the Simpletest module.
i have added files[] = jobs.test in info file

Jobs Tests is visible in http://localhost/drupal7/admin/config/development/testing

'Jobs Tests', 'description' => 'Unit Tests for this module', 'group' => 'Jobs', ); }

function setUp() { parent::setUp(); }

/** public function jobrecivedapplicationTest() { $result = jobs_recieved_applications(); $this->assertNOTNULL($result, 'should retrieve all the informtion'); } */ function jobrecivedmailTest() { require_once(jobsssssss.module); $result = simpletest2(); // $this->assertNOTNULL($result, 'should retrieve all the informtion'); // assertMail($name, $value = '', $message = '') $this->assertMail($result, "kumara.suresh25@gmail.com", 'The last message subject was "My latest email"'); } }

| improve this answer | |
  • This is not the answer. Please use comments. – mixerowsky Sep 30 '15 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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