diff --git a/protected_node.info b/protected_node.info
index a61fbde..853ae03 100644
--- a/protected_node.info
+++ b/protected_node.info
@@ -1,8 +1,11 @@
 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
+files[] = tests/protected_node.per_node.test
\ No newline at end of file
diff --git a/tests/protected_node.per_node.test b/tests/protected_node.per_node.test
new file mode 100644
index 0000000..9bedcfc
--- /dev/null
+++ b/tests/protected_node.per_node.test
@@ -0,0 +1,114 @@
+<?php
+
+/**
+ * Configure protected_node to use per node password.
+ */
+class ProtectedNodePerNodePasswordBaseTestCase extends ProtectedNodeBaseTestCase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp();
+
+    // Per node password
+    $this->drupalLogin($this->adminUser);
+    $protected_node_settings = array(
+      'protected_node_use_global_password' => PROTECTED_NODE_PER_NODE_PASSWORD,
+      'protected_node_email_activation'    => TRUE, // This checkbox is checked here because of a bug in protected node.
+    );
+    $this->drupalPost('admin/config/content/protected_node', $protected_node_settings, t('Save configuration'));
+  }
+
+}
+
+/**
+ * Class to test the password is well stored.
+ */
+class ProtectedNodeNodePasswordHashTestCase extends ProtectedNodePerNodePasswordBaseTestCase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    return array(
+      'name' => 'Node password hash',
+      'description' => "This tests that the password is stored hashed and check the value of the hash",
+      'group' => 'Protected Node',
+    );
+  }
+
+  /**
+   * Test that the password is well hashed when stored.
+   */
+  public function testProtectedNodePasswordHash() {
+    $this->drupalLogin($this->adminUser);
+
+    $node_data = array(
+      'title'                        => $this->randomName(8),
+      'body[und][0][value]'          => $this->randomName(32),
+      'protected_node_is_protected'  => TRUE,
+      'protected_node_passwd[pass1]' => PROTECTED_NODE_NODE_PASSWORD_TEST,
+      'protected_node_passwd[pass2]' => PROTECTED_NODE_NODE_PASSWORD_TEST,
+    );
+    $this->drupalPost('node/add/page', $node_data, t('Save'));
+
+    $node = node_load(1);
+
+    $stored_node_password = db_select('protected_nodes')
+      ->fields('protected_nodes', array('protected_node_passwd'))
+      ->condition('nid', $node->nid)
+      ->execute()
+      ->fetchField();
+    $hashed_node_password = sha1(PROTECTED_NODE_NODE_PASSWORD_TEST);
+
+    $this->assertEqual($stored_node_password, $hashed_node_password, "The node's password is stored hashed and the value correspond to the password.", 'Password per node');
+  }
+
+}
+
+/**
+ * Class to test the view of a protected node protected by a per node password.
+ */
+class ProtectedNodePerNodePasswordViewNodeTestCase extends ProtectedNodePerNodePasswordBaseTestCase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    return array(
+      'name' => 'View a node protected by a per node password',
+      'description' => "This tests a user has to enter the node password to see a node protected by a per node password",
+      'group' => 'Protected Node',
+    );
+  }
+
+  /**
+   * Test that a node protected with per node protection can be seen with the
+   * right password.
+   */
+  public function testProtectedNodePerNodePasswordView() {
+    // Create a protected node.
+    $this->drupalLogin($this->adminUser);
+
+    $node_data = array(
+      'title'                        => $this->randomName(8),
+      'body[und][0][value]'          => $this->randomName(32),
+      'protected_node_is_protected'  => TRUE,
+      'protected_node_passwd[pass1]' => PROTECTED_NODE_NODE_PASSWORD_TEST,
+      'protected_node_passwd[pass2]' => PROTECTED_NODE_NODE_PASSWORD_TEST,
+    );
+    $this->drupalPost('node/add/page', $node_data, t('Save'));
+
+    $node = node_load(1);
+
+    // An authenticated user see the node.
+    $this->drupalLogin($this->normalUser);
+    $password = array('password' => PROTECTED_NODE_NODE_PASSWORD_TEST);
+    $this->drupalPost('node/' . $node->nid, $password, t('OK'));
+
+    $text = $node->body['und'][0]['value'];
+    $this->assertText($text, "The node body appears on the page.", 'Password per node');
+  }
+
+}
\ No newline at end of file
diff --git a/tests/protected_node.test b/tests/protected_node.test
new file mode 100644
index 0000000..312bd68
--- /dev/null
+++ b/tests/protected_node.test
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * Password used for testing per node password protection.
+ */
+define('PROTECTED_NODE_NODE_PASSWORD_TEST', 'password for test: node password');
+
+/**
+ * This class adds the requirements for all protected_node test classes.
+ */
+class ProtectedNodeBaseTestCase extends DrupalWebTestCase {
+
+  protected $adminUser;
+  protected $normalUser;
+
+  /**
+   * Prepare users for protected node's tests.
+   */
+  public function setUp() {
+    parent::setUp('protected_node');
+
+    $this->adminUser = $this->drupalCreateUser(array(
+      'access protected content',
+      'edit any password',
+      'bypass password protection',
+      'view protected content',
+      'administer site configuration',
+      'administer nodes',
+      'bypass node access',
+    ));
+    $this->normalUser = $this->drupalCreateUser(array('access protected content'));
+  }
+
+}
