Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to run MUnit tests inside TestSuite constructs from the command line or a notebook interface without loading the Workbench GUI. I tried


where contains:


and each of the contain standard Test[...] constructs. However, this does not run the tests; I get the output that 0 tests were run. TestRun[""] works. I cannot find documentation for TestRun, so maybe it does not support this, but in that case, how do I run testsuite files without loading the Workbench GUI?

Edit: Since MUnit v1.4 (which is distributed with Mathematica v10) TestRun function correctly handles path to test suite file.

share|improve this question
The code for MUnit package, by the look of it, seems to be really well-written and self-documenting, so, if all else fails, you can read the source and see what is needed to get it to work. What I personally did in a similar situation was that I wrote my own package to load .mt files and have a fine-grained control over them, and also a custom UI to run them in the FrontEnd, and while it worked great for me, I don't want to encourage that approach - it is probably better to use what MUnit provides since there obviously was a lot of work and thought put into that already. – Leonid Shifrin Mar 30 '12 at 13:48
@Leonid There is one good use case for writing one's own .mt runner: distributing tests together with an open source application so people can run it on different platforms without needing WorkBench. I really wish MUnit were part of Mathematica. – Szabolcs Apr 16 '13 at 2:04

Have a look at this post. There is a short explanation how to do it. I use this quite often and it works very well for me.

share|improve this answer
Thanks, but this doesn't really answer the question. I want to use the same TestSuite construct that I use in Workbench outside of Workbench. – Ian Hinder Mar 30 '12 at 13:34

At least as of 10.3, Mathematica ships with MUnit included (I have not used prior versions, so I don't know when it was first included).

I was able to make it work with a script like this:

#! /usr/bin/env MathematicaScript -script

If[MUnit`TestRun["./Tests/"], Exit[0], Exit[1]]

Which, of course, assumes that MathematicaScript is located somewhere on your PATH and you're running the script from the project root directory.

share|improve this answer
It's included since 10.0. But unfortunately this version of MUnit is not compatible with the one in Workbench 2. To run test for projects made with Workbench, we still need to use the MUnit that ships with Workbench. – Szabolcs Dec 18 '15 at 8:38
@Szabolcs: Interesting. Could you share some examples of things that do not work outside of Workbench? – Abbas ibn Firnas Dec 18 '15 at 18:30
So far I've been switching back and forth between the two with no problems - running tests on command line and only going to the Workbench when there're failed cases to examine. But I also haven't used all the features yet, such as child tests... – Abbas ibn Firnas Dec 18 '15 at 18:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.