I have Mathematica 8.0 and Wolfram Workbench 2.0 for the Mac. I want to use MUnit to unit test a package I am creating, but I am finding the lack of documentation on MUnit to be frustrating.
The best resource so for has been Mathematic Cookbook by Sal Mangano. Section 19.11 covers "Integrating Wolfram Workbench’s MUnit Package into the Frontend".
I figure once I expose MUnit to the frontend, I will be able to query the MUnit API with ? . Just one problem, I can't find the MUnit package. I tried to locate the MUnit directory as suggested in the book with:
find / -name MUnit -print 2> /dev/null
, but have not had any luck.
If you up vote this answer, please show Szabolcs some luv by up voting his answer too. He was a tremendous help on this.
The location of MUnit is dependent upon the order that features of Wolfram Workbench were first used. That is just a theory, however it explains why
find
was not able to find MUnit initially, but finds it now. On my system MUnit is located at:To locate MUnit on your system using Wolfram Workbench:
TestID->"MyTest-20111230-L0X3S3"
.To locate MUnit on your system using
find
:find / -name MUnit -print 2> /dev/null
find
results:Once you find the location you can query the MUnit package with: (note: the path most likely be slightly different)
I found
MUnit.m
inwithin the Eclipse (or Workbench) installation directory. I don't have a Mac, but it should be in the same place regardless of platform.
There are also two other versions for Mathematica 6 and 5.2 (replace
Head
in the path withVersion5.2
orVersion6
).As a supplement to the solutions presented by @Szabolcs and @mmorris, here is another way to determine the location of
MUnit.m
.In the Wolfram Workbench, create an MUnit test that looks like this:
Run the test. It will fail, but the actual output of the test will be the desired pathname.