Test cases may use external resources such as configuration files and projects for testing purposes. It is recommended to keep external test resources apart from test case implementation class files. The test framework provides methods for retrieving test resources from the one specific resource directory.
Resource directory can be accessed by calling the com.nomagic.magicdraw.tests.common.TestEnvironment.getResourceDir() method. This method obtains the directory specified by the tests.resources system property. For information about specifying the tests.resources system property see Configure test environment. The test framework also provides methods for collecting projects from the resource directory. Developers may use TestEnvironment.getProjects(java.io.File) for collecting projects recursively from a specific directory. Unnecessary projects can be filtered out by specifying their names in skip.txt files that are placed in the same directory as project files.
Test cases may produce some resources as a test output. The output directory for a specific test case can be created using TestEnvironment.getOutputDir(java.lang.Class). The class here specifies a class of the test case which output directory should be accessed.
There are also methods for working with output files. An output file for a specific project can be simply created by changing the project file extension (TestEnvironment.getFileWithExtension(java.io.File, java.lang.String)) or adding a special prefix to its name (TestEnvironment.createFileNameWithPrefix(java.io.File, java.lang.String) ).