# How do I set up initialization code for Wolfram Workbench MUnit tests?

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.

• 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. – Shredderroy Oct 8 '14 at 0:14
• read this – molekyla777 Oct 8 '14 at 5:44
• @molekyla777 Post it as an answer and I will upvote it. – halirutan Oct 8 '14 at 10:14
• @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. – halirutan Oct 8 '14 at 10:17

Probably Child Test Files can help in your case. link