3
$\begingroup$

Say I have a couple of tests like the following:

Test[
    g[f[10]],
    100,
    TestID -> "Test-1-g"
]

Test[
    h[f[10]],
    200,
    TestID -> "Test-2-h"
]

Further, assume that f[10] is not cheap. So I would like to initialize it as an environment variable for this suite of tests. What is the correct way to do this in MUnit? I cannot seem to find any documentation on the official page for an initialization function.

$\endgroup$
  • $\begingroup$ Never mind! I think just defining a variable at the top of the file, like a = f[10]; works fine! I just thought that everything in a .mt file had to be inside a Test* function of some kind. $\endgroup$ – Shredderroy Oct 8 '14 at 0:14
  • $\begingroup$ read this $\endgroup$ – molekyla777 Oct 8 '14 at 5:44
  • $\begingroup$ @molekyla777 Post it as an answer and I will upvote it. $\endgroup$ – halirutan Oct 8 '14 at 10:14
  • $\begingroup$ @Shredderroy I have removed your comment in your question to close it. I think it is a valid and good question and someone else might stumble upon the same issue at some point. I asked molekyla777 to post an answer. If he doesn't, feel free to do it yourself and include his link to the documentation. $\endgroup$ – halirutan Oct 8 '14 at 10:17
3
$\begingroup$

Probably Child Test Files can help in your case. link

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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