diff --git a/diff.info b/diff.info
index cd95be6..f7b2b6e 100644
--- a/diff.info
+++ b/diff.info
@@ -4,3 +4,4 @@ core = 7.x
 configure = admin/config/content/diff
 
 files[] = DiffEngine.php
+files[] = diff.test
diff --git a/diff.test b/diff.test
new file mode 100644
index 0000000..1e8fb5c
--- /dev/null
+++ b/diff.test
@@ -0,0 +1,149 @@
+<?php
+
+/**
+ * @file
+ * Tests for diff.module.
+ */
+
+/**
+ * Defines a base class for testing the Diff module.
+ */
+class DiffWebTestCase extends DrupalWebTestCase {
+
+  /**
+   * Node used by the test.
+   *
+   * @var object
+   */
+  protected $node;
+
+  /**
+   * Revisions used by the test.
+   *
+   * @var array
+   */
+  protected $revisions;
+
+  /**
+   * The revision messages for node revisions created in the test.
+   *
+   * @var array
+   */
+  protected $logs;
+
+  /**
+   * A user with basic node revision permissions.
+   *
+   * @var object
+   */
+  protected $web_user;
+
+  /**
+   * More or less a copy/paste of NodeRevisionsTestCase::setUp().
+   */
+  function setUp() {
+    // Enable the Diff module.
+    parent::setUp('diff');
+
+    // Create and log in user.
+    $web_user = $this->drupalCreateUser(array('view revisions', 'revert revisions', 'edit any page content',
+      'delete revisions', 'delete any page content'));
+    $this->drupalLogin($web_user);
+
+    // Create initial node.
+    $node = $this->drupalCreateNode();
+    $settings = get_object_vars($node);
+    $settings['revision'] = 1;
+
+    $revisions = array();
+    $logs = array();
+
+    // Store original node.
+    $revisions[] = $node;
+
+    // Create three revisions.
+    $revision_count = 3;
+    for ($i = 0; $i < $revision_count; $i++) {
+      $logs[] = $settings['log'] = $this->randomName(32);
+
+      // Create revision with random title and body and update variables.
+      unset($settings['title']);
+      unset($settings['body']);
+      $this->drupalCreateNode($settings);
+      $node = node_load($node->nid); // Make sure we get revision information.
+      $settings = get_object_vars($node);
+
+      $revisions[] = $node;
+    }
+
+    // Store settings in base class for retrieval from tests later on.
+    $this->web_user = $web_user;
+    $this->node = $node;
+    $this->revisions = $revisions;
+    $this->logs = $logs;
+  }
+
+  /**
+   * Helper function to determine if correct diff comparison output is found.
+   *
+   * @param $rev1
+   *   $revisions array index of the first revision.
+   * @param $rev2
+   *   $revisions array index of the second revision.
+   */
+  function assertDiffComparisonOutput($rev1, $rev2) {
+    $this->assertRaw('<span class="diffchange">' . $this->revisions[$rev1]->title . '</span>');
+    $this->assertRaw('<span class="diffchange">' . $this->revisions[$rev2]->title . '</span>');
+    $this->assertRaw('<span class="diffchange">' . $this->revisions[$rev1]->body[LANGUAGE_NONE][0]['value'] . '</span>');
+    $this->assertRaw('<span class="diffchange">' . $this->revisions[$rev2]->body[LANGUAGE_NONE][0]['value'] . '</span>');
+
+  }
+}
+
+/**
+ * Tests the Diff comparison functionality.
+ */
+class DiffCompareRevisionsTest extends DiffWebTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Diff compare',
+      'description' => 'Tests diff comparison.',
+      'group' => 'Diff',
+    );
+  }
+
+  /**
+   * Tests diff comparison on the node revisions screen.
+   */
+  function testCompareRevisions() {
+    $node = $this->node;
+
+    // Go to the revisions page and verify that the Compare button is there.
+    $this->drupalGet("node/$node->nid/revisions");
+    $this->assertFieldByName('op', t('Compare'), 'Compare button found.');
+
+    // Click it, and verify that there are no errors.
+    $edit = array(
+      'old' => $this->revisions[1]->vid,
+      'new' => $this->revisions[2]->vid,
+    );
+    $this->drupalPost("node/$node->nid/revisions", $edit, t('Compare'));
+
+    // Finally, validate that the output of the comparison is correct.
+    $this->drupalGet($this->getUrl());
+    $this->assertDiffComparisonOutput(1, 2);
+
+    // Ensure next/previous difference links work as well.
+    $this->clickLink(t('< Previous difference'));
+    $this->assertDiffComparisonOutput(0, 1);
+    $this->clickLink(t('Next difference >'));
+    $this->assertDiffComparisonOutput(1, 2);
+
+  //  debug($this->web_user);
+  //  debug($this->node);
+  //  debug($this->revisions);
+  //  debug($this->logs);
+  }
+
+}
\ No newline at end of file
