diff --git a/test/test_spawn.py b/test/test_spawn.py
index c1ba4e9f2d6526e75d7adb145f49eee28956ec25..30bc9d14c36473765ceb79ce4d45d0ab4b035524 100755
--- a/test/test_spawn.py
+++ b/test/test_spawn.py
@@ -1,12 +1,11 @@
-#!/usr/bin/env python
-import unittest
-
 import time
 
 import pcl_expect
 import pcl_expect.spawn
 
-class TestSpawn(unittest.TestCase):
+import test.base
+
+class TestSpawn(test.base.TestCase):
     def test_spawn_sleep_1(self):
         t0 = time.time()
         sleeper = pcl_expect.spawn.Spawn(['sleep', '1'])
@@ -21,8 +20,7 @@ class TestSpawn(unittest.TestCase):
         pid, status = sleeper.close()
         self.assertEqual(status, 0)
         t1 = time.time()
-        self.assertAlmostEqual(t0 + 1.0, t1, 1,
-                               'sleep 1 slept too long or too short')
+        self.assertTimeDiff(t0, t1, 1.0)
 
     def test_spawn_sleep_1_compat(self):
         t0 = time.time()
@@ -38,9 +36,78 @@ class TestSpawn(unittest.TestCase):
         pid, status = sleeper.close()
         self.assertEqual(status, 0)
         t1 = time.time()
-        self.assertAlmostEqual(t0 + 1.0, t1, 1,
-                               'sleep 1 slept too long or too short')
+        self.assertTimeDiff(t0, t1, 1.0)
+
+
+    def test_hello_world(self):
+        hw = pcl_expect.spawn.Spawn(['test/hello.sh'])
+        x = pcl_expect.Controller()
+        while x.loop():
+            if hw.re(x, "hello, world"):
+                break
+        x = pcl_expect.Controller()
+        while hw.eof(x):
+            break
+        pid, status = hw.close()
+        self.assertEqual(status, 0)
 
+    def test_stderr(self):
+        tool = pcl_expect.spawn.Spawn("test/tool.sh")
+        x = pcl_expect.Controller()
+        while x.loop():
+            if tool.re(x, "prompt: "):
+                break
+        tool.send("echo hello, world\n")
+        x = pcl_expect.Controller()
+        while x.loop():
+            if tool.re(x, "hello, world\r?\n"):
+                break
+        tool.send("stderr hello, world\n")
+        x = pcl_expect.Controller()
+        while x.loop():
+            if tool.re(x, "hello, world\r?\n"):
+                break
+        tool.send("bye\n")
+        found = 0
+        x = pcl_expect.Controller()
+        while x.loop():
+            if tool.eof(x):
+                break
+            elif tool.re(x, "Exiting\r?\n"):
+                found += 1
+        self.assertEqual(found, 1)
+        pid, status = tool.close()
+        self.assertEqual(status, 0)
 
-if __name__ == '__main__':
-    unittest.main()
+    def test_stderr_2(self):
+        (tool, stderr) = pcl_expect.spawn.spawn2("test/tool.sh")
+        x = pcl_expect.Controller()
+        while x.loop():
+            if tool.re(x, "prompt: "):
+                break
+        tool.send("echo hello, world\n")
+        x = pcl_expect.Controller()
+        while x.loop():
+            if tool.re(x, "hello, world\r?\n"):
+                break
+        tool.send("stderr hello, world\n")
+        x = pcl_expect.Controller()
+        while x.loop():
+            if stderr.re(x, "hello, world\r?\n"):
+                break
+        tool.send("bye\n")
+        found = 0
+        x = pcl_expect.Controller()
+        while x.loop():
+            if tool.eof(x):
+                break
+            elif tool.re(x, "Exiting\r?\n"):
+                found += 1
+        self.assertEqual(found, 1)
+        x = pcl_expect.Controller()
+        while x.loop():
+            if stderr.eof(x):
+                break
+        pid, status = tool.close()
+        self.assertEqual(status, 0)
+        stderr.close()