diff --git a/tests/relation.test b/tests/relation.test
index 1dfd860..ecc2fe8 100644
--- a/tests/relation.test
+++ b/tests/relation.test
@@ -380,4 +380,110 @@ class RelationAPITestCase extends RelationTestCase {
     // See relation_type_delete_confirm() in relation.admin.inc
     $this->assertRaw(format_plural($num_relations, 'The %label relation type is used by 1 relation on your site. If you remove this relation type, you will not be able to edit  %label relations and they may not display correctly.', 'The %label relation type is used by @count relations on your site. If you remove %label, you will not be able to edit %label relations and they may not display correctly.', array('%label' => $this->relation_types['symmetric']['label'], '@count' => $num_relations)), 'Correct number of relations found (1) for ' . $this->relation_types['symmetric']['label'] . ' relation type.');
   }
+
+  /**
+   * Tests importing method.
+   */
+  function testRelationImport() {
+    // Tests navigate to import page and all fields are available.
+    $this->drupalGet('admin/structure/relation');
+    $this->clickLink(t('Import relation type'));
+    $this->assertFieldByName('name');
+    $this->assertFieldByName('relation_type');
+    $this->assertFieldByName('op', t('Import'));
+
+    // Tests import a relation. The relation name is coming from source. So
+    // first imports a simple relation without adding a different name, check
+    // status message and return to the relations listing page to check the
+    // imported relation is available.
+    $post = array(
+      'relation_type' => '
+        $relation_type = new stdClass();
+        $relation_type->disabled = FALSE; /* Edit this to true to make a default relation_type disabled initially */
+        $relation_type->api_version = 1;
+        $relation_type->relation_type = \'is_similar_to\';
+        $relation_type->label = \'is similar to\';
+        $relation_type->reverse_label = \'is similar to\';
+        $relation_type->directional = 0;
+        $relation_type->transitive = 1;
+        $relation_type->r_unique = 1;
+        $relation_type->min_arity = 4;
+        $relation_type->max_arity = 5;
+        $relation_type->source_bundles = array(
+          0 => \'node:*\',
+        );
+        $relation_type->target_bundles = array();
+      ',
+    );
+    $this->drupalPost(NULL, $post, t('Import'));
+    $this->assertText(t('Successfully imported is_similar_to'));
+    $this->drupalGet('admin/structure/relation');
+    $this->assertLink('is similar to', 0, t('The imported relation is exist'));
+
+    // Navaigates to edit page, checks machine name and the imported data. The
+    // imported data contains the following field checks:
+    // - the selected bundle
+    // - directional checkbox
+    // - transivite checkbox
+    // - unique checkbox
+    // - minimum and maximum arity select lists
+    $this->clickLink('is similar to');
+    // Checks the corect url.
+    $this->assertUrl('admin/structure/relation/manage/is_similar_to', array(), t('The imported machine name is correct.'));
+    // Checks that the correct bundle is selected.
+    $this->assertOptionSelected('edit-source-bundles', 'node:*');
+    // Checks that the other bundles are not selected.
+    foreach (entity_get_info() as $entity_type => $entity) {
+      if ($entity_type != 'node') {
+        $this->assertNoOptionSelected('edit-source-bundles', "$entity_type:*");
+      }
+      if (isset($entity['bundles'])) {
+        foreach ($entity['bundles'] as $bundle_id => $bundle) {
+          $this->assertNoOptionSelected('edit-source-bundles', "$entity_type:$bundle_id");
+        }
+      }
+    }
+    // Checks other datas.
+    $this->assertNoFieldChecked('edit-directional', t('Directional data is imported correct.'));
+    $this->assertFieldChecked('edit-advanced-transitive', t('Transitive data is imported correct.'));
+    $this->assertFieldChecked('edit-advanced-r-unique', t('Unique data is imported correct.'));
+    $this->assertOptionSelected('edit-advanced-min-arity', '4', t('Minimum arity data is imported correct.'));
+    $this->assertOptionSelected('edit-advanced-max-arity', '5', t('Maximum arity data is imported correct.'));
+
+    // Delete unused relation.
+    relation_type_delete('is_similar_to');
+
+    // Tests importing with overridden machine name. So after imporing check
+    // the status message, check that the imported relation is available and
+    // check the modified machine name.
+    $post = array(
+      'name' => 'overridden_import_test',
+      'relation_type' => '
+        $relation_type = new stdClass();
+        $relation_type->disabled = FALSE; /* Edit this to true to make a default relation_type disabled initially */
+        $relation_type->api_version = 1;
+        $relation_type->relation_type = \'is_similar_to\';
+        $relation_type->label = \'is similar to\';
+        $relation_type->reverse_label = \'is similar to\';
+        $relation_type->directional = 0;
+        $relation_type->transitive = 1;
+        $relation_type->r_unique = 1;
+        $relation_type->min_arity = 4;
+        $relation_type->max_arity = 5;
+        $relation_type->source_bundles = array(
+          0 => \'node:*\',
+        );
+        $relation_type->target_bundles = array();
+      ',
+    );
+    $this->drupalPost('admin/structure/relation/import', $post, t('Import'));
+    $this->assertText(t('Successfully imported overridden_import_test'));
+    $this->drupalGet('admin/structure/relation');
+    $this->assertLink('is similar to', 0, t('The imported relation is exist'));
+    $this->clickLink('is similar to');
+    $this->assertUrl('admin/structure/relation/manage/overridden_import_test', array(), t('The imported machine name is correct.'));
+
+    // Delete unused relation.
+    relation_type_delete('is_similar_to');
+  }
 }
