I am having some problems setting up the MUnit testing framework for a J/Link project and would be grateful for advice. I do have J/Link working when running or debugging the .nb notebook in workbench, just can't get it going when trying to run or debug the .mt unit test file.
I did the following steps, following the documentation as closely as i can.
I created a fresh J/Link project, right-click the inner project folder and choose New / TestFile, and I get a tree like the following in the package explorer of workbench:
fooProject
+-- javaSource
+-- JRE System Library [1.1]
+-- fooProject
| +-- Java
| +-- Kernel
| | +-- init.m
| +-- fooProject.m
| +-- fooProject.mt <---- this is my unit test file; can't get it going
+-- fooProject.nb <---- this one works well
I put a couple of functions in my .m package file:
(* Mathematica Package *)
(* Created by the Wolfram Workbench Feb 3, 2012 *)
BeginPackage["fooProject`", {"JLink`"}]
(* Exported symbols added here with SymbolName::usage *)
KvpQ::usage = "Tests whether its argument is a KVPair or KVP, that is, a list of two values, the first of which is a string or symbol Key.";
Begin["`Private`"]
(* Implementation of the package *)
SymbolQ[x_Symbol] := True;
SymbolQ[___] := False (* all other cases produce False *);
KvpQ[kvp_List] := (Length@kvp === 2 &&
(StringQ[kvp[[1]]] || SymbolQ[kvp[[1]]]));
KvpQ[___] := False;
End[]
EndPackage[]
Then I open the MUnit Test file, fooProject.mt, do Ctrl+K and choose the test template, and then fill it out:
(* Mathematica Test File *)
Test[
KvpQ[{}]
,
False
,
TestID->"fooProject-20120203-Q0O8P9"
]
Now, following the directions at the wolfram site on J/Link launching, I create the new configuration as directed accepting all defaults. Then when I try to run the unit tests, I get a dialog with the unsettling message:
The selected file is not a Mathematica notebook or scrapbook file.
Please make sure that a file with extension .nb or .mscrapbook
is selected, then try the run again.
This leads me to suspect that MUnit testing just isn't supported for J/Link projects, which would make me sad :( But it's more likely I've just done something silly wrong.
Again, I'd be grateful for any advice or guidance. Thanks.