Drucumber: testing made easy | how to delegate Drupal testing to your project manager

Drucumber is a new module that converts native-language like text into a Drupal Simpletests.
The idea is not entirely new, other projects like Cucumber have worked to solve this problem, but none of them does so for Drupal (at the time being). Drucumber also doesn't use Cucumber's syntaxis, it uses YAML instead. YAML has a lot of existing tools for processing and has the structural properties of XML while being more accessible for end users. Using YAML makes it also possible to later implement a backend for RDF or RDFa which will open some really exciting possiblities (integration with the semantic markup editor, for instance - remember Spezzle?).
The goal of this module is to allow end-users and project teams to implement behavior driven development: specify behaviors or features of a Drupal site in a test and never again worry about checking it. Here's an example:
feature user test:
info:
name: Administrator user
description: an administrator needs to be able to access the admin menu.
background:
given:
- standard drupal setup
- user with administer site role
scenario link:
should see: link to adminAfter processing the mighty black box of my module delivers the following:
class UserTest extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Administrator user', 'description' => 'an administrator needs to be able to access the admin menu.',
'group' => 'Drucumber',
);
} public function setUp() {
parent::setUp();
$user = $this->drupalCreateUser(array('administer site',));
$this->drupalLogin($user);
} public function testLink() {
$this->assertRaw('href="admin"', 'The specified link (admin) does not exists.');
}
}The indenting is a bit messy, but you can see that this is an actual test.
Currently, the module only works with drush (same way as a regular compiler), but the node support and services integration is on it's way. As mentioned before, possible implementations for RDF integration are also being evaluated. The API is ready for further implementations, and there is plenty of documentation in docs.php.









This seems really great, but I am curious if it is really practical. For someone that doesn't know the Drucumber syntax, let alone the Drupal SimpleTest syntax, it seems like it is just adding another layer of syntax-knowing for little benefit, especially when you take into account that there is often very complicated logic in a test that I doubt Drucumber can translate.
I think this is really cool, and creating easier ways to make tests is very much appreciated, but I am just unsure if this will can really be all that helpful. This is just the impression I get form this article; I have not actually tried the module.
Yes at this point it requires knowledge of the syntax, but we are planning to automate part of that through a WYSIWYG editor.
The RDFa thing that Tamas is hinting at, figures in the Spezzle concept that we have been working on for some time. This is a concept where multiple types of information can be added into the specification for a project using a WYSIWYG editor. You could for example have your functional specification, technical specification, tickets, documentation and now also tests in the same document.
So what you see here is not the final product ;)
"specify behaviors or features of a Drupal site in a test and never again worry about checking it"
While automated tests certainly make development more stable I think this statement really gives the wrong impression. Testing is not some sort of utopia where code never breaks. A good portion of code alterations require corresponding alterations to an automated test.
It's never worry about checking - the thing for which you wrote to test. Obviously when refactoring code you often need to refactor your tests...