--- a/projects/TGScheduler/trunk/tgscheduler/tests/test_scheduler.py
+++ b/projects/TGScheduler/trunk/tgscheduler/tests/test_scheduler.py
@@ -144,6 +144,24 @@
         self.assertTrue(get_task('badtask') is None)
         self.assertTrue('badtask' not in get_tasks())
 
+    def test_cancel_task_by_name(self):
+        """Test to cancel a task using its taskname."""
+        task = add_single_task(functest, taskname='badtask')
+        self.assertEqual(task.name, 'badtask')
+        self.assertEqual(get_task('badtask'), task)
+        self.assertTrue('badtask' in get_tasks())
+        cancel('badtask')
+        self.assertTrue(get_task('badtask') is None)
+        self.assertTrue('badtask' not in get_tasks())
+
+    def test_cancel_task_not_exists(self):
+        """Test to cancel a task that does not exist."""
+        self.assertTrue(get_task('badtask') is None)
+        self.assertTrue('badtask' not in get_tasks())
+        cancel('badtask')
+        self.assertTrue(get_task('badtask') is None)
+        self.assertTrue('badtask' not in get_tasks())
+
 
 if __name__ == '__main__':
     unittest.main()