
Jimmy Berry
boombatower
- General core developer
- Drupal 7 Testing Subsystem Maintainer
- Developer and maintainer of testing.drupal.org
This Summer I will be working part-time as an intern for Acquia. I am very excited to be working with Acquia and having the chance to spend more time improving things that I have interest in. To clarify I will be working on projects that benefit the entire Drupal community. The items I will be working on are improvements to projects I have either started or that I am heavily involved with.
During the discussion of the internship I came up with the following goals that were then prioritized by Dries.
Primary goals
Secondary goals
I will post updates on some of the more interesting items as they are accomplished. Additionally, I would like to give a special thanks to Kieran Lal for his mentoring and help in finding me sponsorship.
FOLLOW UP:
To clarify I will still be participating in Google Summer of Code 2009, which was explicit in my agreement with Acquia.
Follow up post by Dries.
I will be on vacation starting tomorrow morning (Sunday - 5/9/09) for about a week. See everyone on the other side.
I decided to pull gather some statistics about the automated testing system. These statistics were collected on Wednesday, May 6, 2009 at 4:00 AM GMT. Automatic generation of these statistics along with analysis is a feature I have in mind for ATS 2.0. I appreciate donations to the chipin (right), as this project requires a lot of development time.
From the data you can see that the test slaves have been running tests for the equivalent of 200 days. The system has been running for 192 days and not all the data was included since some of it is inaccurate. That means the system has saved 200 days of developer's time! It is clear that the ATS is a vital part of test driven development. Additionally the time that would have been spent fixing regressions and new bugs has been drastically lowered.
| Item | Function | Value |
|---|---|---|
| Time testing | SUM | 17,310,047 seconds (~288,500 minutes, ~200 days) |
| Test run (test suite) | COUNT | 42,351 |
| MAX | 3620 seconds (~60 minutes) | |
| MIN | 17 seconds | |
| AVG | 804 seconds (~ 13 minutes) | |
| STDDEV_POP | 783 seconds (~13 minutes) | |
| Test (patch, times tested) | COUNT | 6,953 |
| MAX | 86 | |
| MIN | 1 | |
| AVG | 10 | |
| STDDEV_POP | 15 | |
| Test pass count | MAX | 11,453 |
| MIN | 0 | |
| AVG | 4,265 | |
| STDDEV_POP | 4,910 | |
| Test fail count | MAX | 6,989 |
| MIN | 0 | |
| AVG | 9 | |
| STDDEV_POP | 155 | |
| Test exception count | MAX | 813,795 |
| MIN | 0 | |
| AVG | 160 | |
| STDDEV_POP | 9,893 |
One item you may notice is the maximum test exception count of 813,795. The patch that caused that many exceptions proved that our system is scalable! The patch is much appreciated. :)
Saved the current test result breakdown.
The average test run length for all the active test slaves can be seen below. This data is only looking at the latest test run for each patch in the system.
| Test slave | Average test length* |
|---|---|
| 4 | 730 seconds |
| 5 | 1,753 seconds |
| 7 | 1,352 seconds |
| 8 | 576 seconds |
| 9 | 2,438 seconds |
| 10 | 1,942 seconds |
| 12 | 1,161 seconds |
| 16 | 217 seconds |
* Excludes test runs that do not pass initial checks and fail before running test suite.
Over the next few weeks I plan to make a number of posts about the new features provided by ATS 2.0 and the benefits to the community. Currently, the system is in the final stages of deployment, but is not yet active. Please be aware that these features will be available once ATS 2.0 has been deployed. I appreciate donations to the chipin (right), as this project requires a lot of development time.
Server management
One of the major restraints holding back the expansion of the system has been the need to manually oversee the array of testing servers. The new system contains a number of enhancements to make it not only easier to manage the network, but also automates the task of adding new clients.
The most important addition that makes all this possible is the automatic client testing. Clients are automatically tested to ensure they are functioning properly. This is done through a set of tests that are sent to each test client with an expected result. The results the client sends back and compared with the expected result and that information is used to determine if the client is functioning properly. Clients are tested on a regular basis to ensure that they continue functioning as expected.
Another helpful change has been re-working the underlying architecture to use a pull based protocol instead of a push based protocol. This alleviates the issues caused when a client is unreachable for a period of time, or is removed without notice.
Public server queue
Another improvement that will facility a larger testing network is the public server queue. Allowing anyone to add a server to the network is possible since the clients are automatically tested as described above.
The interface has been designed so that users may control the set of machines that they have added to the network. The system automatically assigns the client a key that must be stored on the client and is used for authentication. The process of adding a client to the master list is very simple and should provide an easy way for users to donate servers.
If the system detects any issues with the client down the line, such as becoming out of date, it will notify the server administrator of the problem and disable the test client. The system will continually re-test the client and re-enable it automatically if it passes inspection. Alternatively, the server administrator may request the client to be tests immediately after fixing the issue.
Multiple database support
The new system has been abstracted to allow for the support of PostgreSQL and SQLite in addition to MySQL. This is vital to ensure that the Drupal 7 properly supports all three databases. Just as patches are not committed until they pass all the tests, patches will not be committed until after passing all the test on all three databases (5 environments with the database variations).
I maintain a backport of Drupal 7 SimpleTest for use with Drupal 6 as the SimpleTest module 2.x branch. A fair amount of work goes into maintaining the code even though it is a backport.
Tonight I finished up a fresh backport of Drupal 7 and made a release along with a number of other changes. Please update to SimpleTest 6.x-2.8 and report any issues you find.
Note to developers
Since this release includes a fresh backport it also contains an API change that you need to be aware of. All getInfo() methods need to be changed to static before using this release. If you are a module developer or maintain tests internally please make sure you update them.
Old
<?php
function getInfo() {
return array(
'name' => t('[name]'),
'description' => t('[description]'),
'group' => t('[group]'),
);
}
?>New
<?php
public static function getInfo() {
return array(
'name' => t('[name]'),
'description' => t('[description]'),
'group' => t('[group]'),
);
}
?>During the last several months I put a substantial amount of work into improving the Automated Testing System. Future posts will describe the exciting new features and the benefits to the community. If interested, a brief overview of some of the requirements can be found in the PIFR and PIFT issue queues.
For additional background, the original thoughts can be found at the following links:
Final steps
There a number of steps that need to be completed before the Drupal community can reap the benefits of the new system.
Future
Once the second generation framework is in place and running smoothly I will begin work on finishing the last pieces required to allow for testing of contributed modules (D6 and D7) and Drupal 6 core. I will be writing more on the new features and UX improvements to be looking for in during the upcoming deployment.
Google announced the accepted student proposals today, of which my proposal was included. The project will finalize the Usability Testing Suite which was started during Summer of Code 2008. At the conclusion of this year's Summer of Code I hope to have the project ready for prime time use which will make it easier to conduct a number of different usability studies.
For a bit more detail on the project I have included the project abstract.
The Usability Testing Suite that I created during SoC 2008 needs additional work in order to make it ready for use. The existing module provides a powerful API that makes writing data collection plug-ins simple, but the user interface needs refinement and a screen recording plug-in would make the module much more helpful. Through this project I intend to finalize the Usability Testing Suite and make it ready for widespread use.
On another note, my father was also accepted! As confirmed by Károly "chx" Négyesi we are the first father-son pair to be accepted into Summer of Code.
I have attached the full project proposal that I submitted.
I will be presenting Saving webchick time - the saga along with Kieran Lal at Drupalcon DC 2009. To quote the session abstract:
One of the major enhancements made to the Drupal development cycle has been the addition of a fully automated testing bot, built on the testing framework in Drupal 7.
This session will focus on automated testing as it relates to Drupal 7: its history and direction, the automated testing bot: what has gone into it and where the future leads, and most importantly what is the end gain to the Drupal community.
The framework has gone through a rather long and interesting history with a number of road-blocks and challenges that have been overcome. The session will tell the story of the framework and the benefits it provides to the community through the enhanced Drupal 7 development work-flow. Although the session will go into some technical details it will overall tell the story of the framework and where we plan to take it. The presentation should be interesting to most and provide a great time to throw out any comments or concerns.
After the presentation I will stick around to discuss our recent launch of the Boombatower Testing Service (BTS). If you have any questions, comments, or concerns please drop by.
I am sure by now most, if not all, are aware of the drupal.org upgrade to Drupal 6 and may have noticed some of the changes. After the upgrade was completed I went ahead and posted my updated hook_test() patch to Create hook_test(): move SimpleTest getInfo() out of test cases. Upon posting I noticed that the file was uploaded to:
http://drupal.org/files/
instead of
http://drupal.org/files/issues/
That may not sounds like much of an issue, but it has a number of trickle effects.
I talked with Chad "hunmonk" Phillips about it in IRC and discovered that is was due to the new File API. Drupal.org was put in maintenance mode, as many of you probably noticed, and Chad dove into the code. After discussing for a while a "fix" was created.
The moral of the story...yet another bug found due to SimpleTest (the patch I was posting was related to SimpleTest). That of course is not to say it would not have been found soon enough, but SimpleTest indirectly found it first. :)
Situation
The SimpleTest browser that is included in the Drupal 7 core is very powerful and I have found myself hacking in order to use it outside of SimpleTest on a number of occasions, as have others. In addition the DrupalWebTestCase is becoming rather bloated. There is an issue to create pluggable backends for drupal_http_request which could be cleanly done by abstracting the SimpleTest browser. The change would create a clean and more powerful API as well as open up a number of possibilities by having a browser built into Drupal core and thus is something worth working on.
Solution
A while back I did some work towards abstracting the SimpleTest browser, not only out of DrupalWebTestCase, but improving/cleaning the code and writing it with a pluggable backend layer. The code is quite far along and just needs a bit more refinement before it can replace the existing SimpleTest browser. The next step would be to replace drupal_http_request or make it a wrapper. After that, areas of core that parse HTML and such can be cleaned up and simplified using the browser.
Possibilities
With a browser in core there are a number of powerful tools that can very easily be added. For instance install and update scripts that can trigger remote servers!! Think of having a single script on a development machine that runs the update script on all specified sites!
Installing via a script can be very usefull not only for the obvious, but also for modules like the Usability Testing Suite and Project Issue File Review that have to make separate installations of Drupal and currently must maintain their own install scripts. Having an abstracted installation script is necessary for testing.drupal.org to be able to function with patches that make changes to the installer.
I plan to work on this further, but have been busy with other projects lately and my recent video card experience. I would like to hear some feedback from the community and possibly recruit some help.
Related issues