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:
/Applications/Wolfram\ Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Head/MUnit
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:
/Applications/Wolfram Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Head/MUnit
/Applications/Wolfram Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Version5.2/MUnit
/Applications/Wolfram Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Version6/MUnit
Once you find the location you can query the MUnit package with: (note: the path most likely be slightly different)
AppendTo[$Path,
FileNameJoin[{"/", "Applications", "Wolfram Workbench.app",
"configuration", "org.eclipse.osgi", "bundles", "214", "1", ".cp",
"MathematicaSourceVersioned", "Head", "MUnit"}]];
Needs["MUnit`"];
?MUnit`*
(* Need a blank line after ?MUnit`* otherwise a nasty message is generated. *)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With