diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py
index 001ebfaef0b8d679c5b71b0f762038b945664dd0..f93d126851771758cd930ba102f7ebacde82aa90 100644
--- a/lib/spack/spack/cmd/test.py
+++ b/lib/spack/spack/cmd/test.py
@@ -39,9 +39,12 @@ def setup_parser(subparser):
         'names', nargs='*', help="Names of tests to run.")
     subparser.add_argument(
         '-l', '--list', action='store_true', dest='list', help="Show available tests")
-    # TODO: make XML output optional
     subparser.add_argument(
-        '-d', '--outputDir', dest='outputDir', help="Nose creates XML files in this directory")
+        '--createXmlOutput', action='store_true', dest='createXmlOutput', 
+        help="Create JUnit XML from test results")
+    subparser.add_argument(
+        '--xmlOutputDir', dest='xmlOutputDir', 
+        help="Nose creates XML files in this directory")
     subparser.add_argument(
         '-v', '--verbose', action='store_true', dest='verbose',
         help="verbose output")
@@ -53,10 +56,14 @@ def test(parser, args):
         colify(spack.test.list_tests(), indent=2)
 
     else:
-        if not args.outputDir:
-            outputDir = join_path(os.getcwd(), "test-output")
+        if not args.createXmlOutput:
+            outputDir = None
         else:
-            outputDir = args.outputDir
-        if not os.path.exists(outputDir):
-            mkdirp(outputDir)
+            if not args.xmlOutputDir:
+                outputDir = join_path(os.getcwd(), "test-output")
+            else:
+                outputDir = os.path.abspath(args.xmlOutputDir)
+            
+            if not os.path.exists(outputDir):
+                mkdirp(outputDir)
         spack.test.run(args.names, outputDir, args.verbose)
diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py
index 158e8bdfcb373f62310bf833542615cf30af2b03..cb75f15ca19901ab833edc7f4089a4fe95ab654f 100644
--- a/lib/spack/spack/test/__init__.py
+++ b/lib/spack/spack/test/__init__.py
@@ -92,11 +92,13 @@ def run(names, outputDir, verbose=False):
         
         tty.msg("Running test: %s" % test)
         
-        xmlOutputFname = "unittests-{0}.xml".format(test)
-        xmlOutputPath = join_path(outputDir, xmlOutputFname)
-        runOpts = ["--with-%s" % spack.test.tally_plugin.Tally.name, 
-            "--with-xunit", 
-            "--xunit-file={0}".format(xmlOutputPath)]
+        runOpts = ["--with-%s" % spack.test.tally_plugin.Tally.name]
+        
+        if outputDir:
+            xmlOutputFname = "unittests-{0}.xml".format(test)
+            xmlOutputPath = join_path(outputDir, xmlOutputFname)
+            runOpts += ["--with-xunit", 
+                "--xunit-file={0}".format(xmlOutputPath)]
         argv = [""] + runOpts + [module]
         result = nose.run(argv=argv, addplugins=[tally])
 
diff --git a/lib/spack/spack/test/tally_plugin.py b/lib/spack/spack/test/tally_plugin.py
index e314fae6cef4b37cc7331a09594f6a8c474345d7..c167d5852946675acc9cfa9ec84d4f863e311be3 100644
--- a/lib/spack/spack/test/tally_plugin.py
+++ b/lib/spack/spack/test/tally_plugin.py
@@ -35,6 +35,7 @@ def __init__(self):
         self.failCount = 0
         self.errorCount = 0
     
+    # TODO: this doesn't account for the possibility of skipped tests
     @property
     def numberOfTests(self):
         return self.errorCount + self.failCount + self.successCount