Hello, Some months ago, I had inquired about the current state of the Drupal test suite in this forum. At that time there were some issues in running the simpletest module for Drupal 4.6.5. A team at SpikeSource, Inc. (http://www.spikesource.com) - where I work - has recently developed a test suite for Drupal that comprises of 5925 functional tests that exercise more than 50% of the code. This test suite runs against both MySQL and PostgreSQL back ends. The test suite is developed using following open source tools: * TestGen4Web: Used for recording user actions through browser and then translating them into SimpleTest test cases. http://developer.spikesource.com/projects/testgen4web/ * SimpleTest: PHP unit and functional testing tool. (http://www.lastcraft.com/simple_test.php) * PHPCoverage: PHP line coverage measurement tool. (http://developer.spikesource.com/projects/phpcoverage/) Currently, the test suite works against a deployed and configured instance of Drupal 4.6.6 with 99.98% tests passing. (SimpleTest counts each assertion as a test case.) The test suite covers following modules in addition to the core modules. * article * event * fckeditor * flexinode * image * img_assist We would like to contribute this test suite so that more people can add to it and improve it. Please let me know if anyone might be interested in taking a look at it and carrying this discussion forward. Thanks, Nimish -- SpikeSource, Inc.
On Fri, Apr 28, 2006 at 11:05:34AM -0700, Nimish Pachapurkar wrote:
We would like to contribute this test suite so that more people can add to it and improve it.
Please let me know if anyone might be interested in taking a look at it and carrying this discussion forward.
I'd be interested in checking it out. Is it available for download somewhere? Thanks, -- Keegan Quinn <keegan@thebasement.org> http://keegan.sniz.org q="'" qq='echo q=\"$q\" qq=$q$qq$q \&\& eval \$qq' && eval $qq
Lets get it in... There is no reason that work should not find its way into core or be updated for 4.7. On Fri, 2006-04-28 at 11:05 -0700, Nimish Pachapurkar wrote:
Hello,
Some months ago, I had inquired about the current state of the Drupal test suite in this forum. At that time there were some issues in running the simpletest module for Drupal 4.6.5.
A team at SpikeSource, Inc. (http://www.spikesource.com) - where I work - has recently developed a test suite for Drupal that comprises of 5925 functional tests that exercise more than 50% of the code. This test suite runs against both MySQL and PostgreSQL back ends.
The test suite is developed using following open source tools:
* TestGen4Web: Used for recording user actions through browser and then translating them into SimpleTest test cases. http://developer.spikesource.com/projects/testgen4web/
* SimpleTest: PHP unit and functional testing tool. (http://www.lastcraft.com/simple_test.php)
* PHPCoverage: PHP line coverage measurement tool. (http://developer.spikesource.com/projects/phpcoverage/)
Currently, the test suite works against a deployed and configured instance of Drupal 4.6.6 with 99.98% tests passing. (SimpleTest counts each assertion as a test case.) The test suite covers following modules in addition to the core modules.
* article * event * fckeditor * flexinode * image * img_assist
We would like to contribute this test suite so that more people can add to it and improve it.
Please let me know if anyone might be interested in taking a look at it and carrying this discussion forward.
Thanks, Nimish
-- SpikeSource, Inc.
Sounds very interesting. Did you uncover bugs in the modulesn and contribute fixes? They could not all have passed all tests. The right way to integrate your work into Drupal project is to move the tests into a 'tests' subdirectory of each of those modules. Then you need a brief implementation of hook_simpletest in the module itself. See http://drupal.org/simpletest for docs. The organic groups module (i.e. Og.module) is an example of a contrib module which implements this hook and currently ships with tests (HEAD/4.7 only). I encourage more contrib modules to follow its lead. Also, you will want to update your tests for 4.7 which is very near. On 4/28/06 2:05 PM, "Nimish Pachapurkar" <npac@spikesource.com> wrote:
Hello,
Some months ago, I had inquired about the current state of the Drupal test suite in this forum. At that time there were some issues in running the simpletest module for Drupal 4.6.5.
A team at SpikeSource, Inc. (http://www.spikesource.com) - where I work - has recently developed a test suite for Drupal that comprises of 5925 functional tests that exercise more than 50% of the code. This test suite runs against both MySQL and PostgreSQL back ends.
The test suite is developed using following open source tools:
* TestGen4Web: Used for recording user actions through browser and then translating them into SimpleTest test cases. http://developer.spikesource.com/projects/testgen4web/
* SimpleTest: PHP unit and functional testing tool. (http://www.lastcraft.com/simple_test.php)
* PHPCoverage: PHP line coverage measurement tool. (http://developer.spikesource.com/projects/phpcoverage/)
Currently, the test suite works against a deployed and configured instance of Drupal 4.6.6 with 99.98% tests passing. (SimpleTest counts each assertion as a test case.) The test suite covers following modules in addition to the core modules.
* article * event * fckeditor * flexinode * image * img_assist
We would like to contribute this test suite so that more people can add to it and improve it.
Please let me know if anyone might be interested in taking a look at it and carrying this discussion forward.
Thanks, Nimish
-- SpikeSource, Inc.
I had thought about the idea of disintegrating the tests based on the module. However, the test are functional in nature, and this approach will work better for Unit tests, IMHO. Some of the tests may need more than one module configured and working to get them to run. I am afraid, I do not have many cycles just yet to try and get the suite to work with Drupal 4.7. The amount of work needed will depend on how much the UI has changed. We did uncover a couple of bugs with PostgreSQL which I have already submitted patches to. Thanks, Nimish Moshe Weitzman wrote:
Sounds very interesting. Did you uncover bugs in the modulesn and contribute fixes? They could not all have passed all tests.
The right way to integrate your work into Drupal project is to move the tests into a 'tests' subdirectory of each of those modules. Then you need a brief implementation of hook_simpletest in the module itself. See http://drupal.org/simpletest for docs. The organic groups module (i.e. Og.module) is an example of a contrib module which implements this hook and currently ships with tests (HEAD/4.7 only). I encourage more contrib modules to follow its lead.
Also, you will want to update your tests for 4.7 which is very near.
On 4/28/06 2:05 PM, "Nimish Pachapurkar" <npac@spikesource.com> wrote:
Hello,
Some months ago, I had inquired about the current state of the Drupal test suite in this forum. At that time there were some issues in running the simpletest module for Drupal 4.6.5.
A team at SpikeSource, Inc. (http://www.spikesource.com) - where I work - has recently developed a test suite for Drupal that comprises of 5925 functional tests that exercise more than 50% of the code. This test suite runs against both MySQL and PostgreSQL back ends.
The test suite is developed using following open source tools:
* TestGen4Web: Used for recording user actions through browser and then translating them into SimpleTest test cases. http://developer.spikesource.com/projects/testgen4web/
* SimpleTest: PHP unit and functional testing tool. (http://www.lastcraft.com/simple_test.php)
* PHPCoverage: PHP line coverage measurement tool. (http://developer.spikesource.com/projects/phpcoverage/)
Currently, the test suite works against a deployed and configured instance of Drupal 4.6.6 with 99.98% tests passing. (SimpleTest counts each assertion as a test case.) The test suite covers following modules in addition to the core modules.
* article * event * fckeditor * flexinode * image * img_assist
We would like to contribute this test suite so that more people can add to it and improve it.
Please let me know if anyone might be interested in taking a look at it and carrying this discussion forward.
Thanks, Nimish
-- SpikeSource, Inc.
Hello Nimish, thanks for your input. I am really interested in this testsuite. I have tried TestGen4Web myself and it looks promising. However I think there are still alot of additional tasks to do with the autogenerated test. For example a simple registration test looks like: $this->get("http://localhost/projekte/drupal_head/"); $this->assertTitle("drupal"); $this->clickLink("Create new account"); $this->assertTitle("user account | drupal"); $this->setFieldById("edit-name", "testacc1"); $this->setFieldById("edit-mail", "testacc1@example.com"); $this->click("Create new account"); $this->assertTitle("drupal"); - The get url has to be replaced by url() usage to work also on different setups - The edit fields should be replaced by random names. - clickLink should be wrapped by t(), this might be done by DrupalTestCase - Imho there should be more assertations, especially for wanted Drupal messages (account created) and unwanted ones (access denied) - Some generated assertations will be based on setup, e.g. sitename. How much manual work have you done with the autogenerated tests? -- Best regards, Thomas mailto:ThomasIlsche@gmx.de
Hello All, Sorry for disappearing for a couple of days. I was out of office. For the lack of a better idea, I have created an issue task at Drupal.org and attached the test suite tarball to it. The tarball is only about 78 KB, so I hope this approach is not too wild. http://drupal.org/node/61533 Please take a look and try out if needed. Thomas, I agree with your point about TestGen4Web test generation. I wrote the SimpleTest generator for TestGen4Web and in my experience, there is some manual tweaking of the test code still needed to make it pretty and tidy. There are some constraints to make it all automated - some of them because the way SimpleTest differs from tools like HttpUnit. Anyway, about your 3rd point, that is already supported. When recording test cases with TestGen4Web, you can select any text on the page, right click and add an assertion. This will then be converted to assertText() call during SimpleTest test cases generation. Thanks, Nimish Thomas Ilsche wrote:
Hello Nimish,
thanks for your input. I am really interested in this testsuite. I have tried TestGen4Web myself and it looks promising. However I think there are still alot of additional tasks to do with the autogenerated test.
For example a simple registration test looks like:
$this->get("http://localhost/projekte/drupal_head/"); $this->assertTitle("drupal"); $this->clickLink("Create new account"); $this->assertTitle("user account | drupal"); $this->setFieldById("edit-name", "testacc1"); $this->setFieldById("edit-mail", "testacc1@example.com"); $this->click("Create new account"); $this->assertTitle("drupal");
- The get url has to be replaced by url() usage to work also on different setups - The edit fields should be replaced by random names. - clickLink should be wrapped by t(), this might be done by DrupalTestCase - Imho there should be more assertations, especially for wanted Drupal messages (account created) and unwanted ones (access denied) - Some generated assertations will be based on setup, e.g. sitename.
How much manual work have you done with the autogenerated tests?
Nimish Pachapurkar wrote:
Hello All,
Sorry for disappearing for a couple of days. I was out of office.
For the lack of a better idea, I have created an issue task at Drupal.org and attached the test suite tarball to it. The tarball is only about 78 KB, so I hope this approach is not too wild.
Please take a look and try out if needed.
Thomas,
I agree with your point about TestGen4Web test generation. I wrote the SimpleTest generator for TestGen4Web and in my experience, there is some manual tweaking of the test code still needed to make it pretty and tidy. There are some constraints to make it all automated - some of them because the way SimpleTest differs from tools like HttpUnit.
Anyway, about your 3rd point, that is already supported. When recording test cases with TestGen4Web, you can select any text on the page, right click and add an assertion. This will then be converted to assertText() call during SimpleTest test cases generation.
Sorry, please read that as "about your 4th point" (about additional assertions).
Thanks, Nimish
Thomas Ilsche wrote:
Hello Nimish,
thanks for your input. I am really interested in this testsuite. I have tried TestGen4Web myself and it looks promising. However I think there are still alot of additional tasks to do with the autogenerated test.
For example a simple registration test looks like:
$this->get("http://localhost/projekte/drupal_head/"); $this->assertTitle("drupal"); $this->clickLink("Create new account"); $this->assertTitle("user account | drupal"); $this->setFieldById("edit-name", "testacc1"); $this->setFieldById("edit-mail", "testacc1@example.com"); $this->click("Create new account"); $this->assertTitle("drupal");
- The get url has to be replaced by url() usage to work also on different setups - The edit fields should be replaced by random names. - clickLink should be wrapped by t(), this might be done by DrupalTestCase - Imho there should be more assertations, especially for wanted Drupal messages (account created) and unwanted ones (access denied) - Some generated assertations will be based on setup, e.g. sitename.
How much manual work have you done with the autogenerated tests?
There definitely was some manual work required. I am not how much 'cause I did not really work on that part. I think that updating the test suite going forward will be hopefully much easier than getting it work completely initially. Thanks, - Nimish
participants (5)
-
Darrel O'Pry -
Keegan Quinn -
Moshe Weitzman -
Nimish Pachapurkar -
Thomas Ilsche