I think an important purpose of the new Testing Notebook
in version 10 should be to test user packages (instead to test the builtin functions in the System
context). However, what's the proper way to load a package into the testing notebook? I didn't find an example in documentation.
What I have tried is to simply load it as an input. But it doesn't seem to work. For example, I have a file test.m in the system directory, with
BeginPackage["test`"]
testFunc
EndPackage[]
Then I start Mathematica, open File->New->Testing Notebook
, and input the following as separate input cells:
<< test.m (* also tried Needs["test`"] without difference *)
and
testFunc
If I evaluate each cell by hand, there is no problem. But if I quit the kernel (to start over) and then hit the run
button, I sometimes got shadowing messages: testFunc::shdw
. By sometimes I mean I did a few tests, each time quit the kernel and start over, and the result is either as left or right of the attached figure
I got really confused here. Also, in the expected output of the right panel, the context becomes explicit. This is quite annoying for a long expression with a long context. I was wondering if it is normal.