0

I have gone through several links but did not get proper information. It looks same as module file but how to execute it in real application. That`s my problem.

1 Answer 1

2

.test files are used for executing Unit tests for your application. Steps are that you write a .test file with a class that extends DrupalWebTestCase (or DrupalUnitTestCase). In this class you add a static function getInfo() that returns an array with information about the test. Then you add as many methods (functions) to the class that perform tests on your application. Each method's name should start with "test".

Check out the simpletest example module for more information: http://cgit.drupalcode.org/examples/tree/simpletest_example

After creating the .test file, reference it from your .module file in the files[] section. Then to run a test you can go to /admin/config/development/testing, select your test (with info provided in getInfo function) and run it. (this assumes both your module and the core module Testing are enabled)

More info? Check: drupal.org -> /node/811254 and /simpletest-tutorial-drupal7#running_tests

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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