diff --git a/protected_node.info b/protected_node.info
index a61fbde..cbb0a70 100644
--- a/protected_node.info
+++ b/protected_node.info
@@ -1,8 +1,10 @@
 name = Protected Node
 description = Controls whether selected nodes are protected with a password. Works even better with the Token module.
 core = 7.x
 version = 7.x-dev
 package = Access
 configure = admin/config/content/protected_node
 recommends[] = tokens
 recommends[] = upload
+
+files[] = tests/protected_node.test
\ No newline at end of file
diff --git a/tests/protected_node.test b/tests/protected_node.test
new file mode 100644
index 0000000..2c642ee
--- /dev/null
+++ b/tests/protected_node.test
@@ -0,0 +1,79 @@
+<?php
+
+define('PROTECTED_NODE_GLOBAL_PASSWORD_TEST', 'password for tests');
+
+/**
+ * This class adds the requirements for all protected_node test classes.
+ */
+class ProtectedNodeBaseTestCase extends DrupalWebTestCase {
+  protected $adminUser;
+  protected $normalUser;
+
+  public function setUp() {
+    parent::setUp('protected_node');
+
+    $this->adminUser = $this->drupalCreateUser(array('access protected content', 'administer site configuration'));
+    $this->normalUser = $this->drupalCreateUser(array('access protected content'));
+  }
+}
+
+/*************************
+ *       Global Password
+ *************************/
+
+/**
+ * Configure protected_node to use global password only.
+ */
+class ProtectedNodeGlobalPasswordBaseTestCase extends ProtectedNodeBaseTestCase {
+
+  public function setUp() {
+    parent::setUp();
+
+    $this->drupalLogin($this->adminUser);
+    $edit = array(
+      'protected_node_use_global_password'          => array(PROTECTED_NODE_GLOBAL_PASSWORD),
+      'protected_node_global_password_field[pass1]' => PROTECTED_NODE_GLOBAL_PASSWORD_TEST,
+      'protected_node_global_password_field[pass2]' => PROTECTED_NODE_GLOBAL_PASSWORD_TEST,
+      'protected_node_email_activation'             => TRUE, // This checkbox is checked here because of a bug in protected node.
+    );
+    $this->drupalPost('admin/config/content/protected_node', $edit, t('Save configuration'));
+
+  }
+}
+
+/**
+ * Class to test the creation of a protected node.
+ */
+class ProtectedNodeGlobalPasswordViewNodeTestCase extends ProtectedNodeGlobalPasswordBaseTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'View a node protected by a global password',
+      'description' => "This tests a user has to enter the global password to see a node protected by the global password",
+      'group' => 'Protected Node',
+    );
+  }
+
+  public function testProtectedNodeGlobalPasswordView() {
+    // Create a protected node.
+    $settings = array(
+      'protected_node_is_protected' => TRUE,
+      'protected_node_show_title'   => TRUE, // To be removed here to follow the test.
+      'protected_node_emails'       => '',    // To be removed here to follow the test.
+    );
+    $node = $this->drupalCreateNode($settings);
+
+    // The global password is well hashed.
+    $global_password = variable_get('protected_node_global_password');
+    $hashed_password = sha1(PROTECTED_NODE_GLOBAL_PASSWORD_TEST);
+    $this->assertEqual($global_password, $hashed_password, "The global password is stored hashed in its variable.", 'Global Password');
+
+    // An authenticated user see the node.
+    $this->drupalLogin($this->normalUser);
+    $password = array('password' => PROTECTED_NODE_GLOBAL_PASSWORD_TEST);
+    $this->drupalPost('node/' . $node->nid, $password, t('OK'));
+
+    $text = $node->title;
+    $this->assertText($text, "The node title appears on the page.", 'Global Password');
+  }
+}
\ No newline at end of file
