gives the absolute file name of the currently executing test file.
$TestFileName
gives the absolute file name of the currently executing test file.
Details
- During the execution of TestReport[file], $TestFileName is set to the absolute file name of file.
- During interactive input, $TestFileName is "".
Examples
Basic Examples (3)
During interactive input, $TestFileName is "":
$TestFileNameThis test file prints $TestFileName when it is executed:
file = FileNameJoin[{"ExampleData", "example.wlt"}];
FilePrint[file]Execute the test file with TestReport:
TestReport[FileNameJoin[{"ExampleData", "example.wlt"}]]After the TestReport is complete, $TestFileName is "" again:
$TestFileNameOpen an example test notebook:
file = FileNameJoin[{$InstallationDirectory, "Documentation", $Language, "System", "ExampleData", "ExampleTestFile.nb"}];
NotebookOpen[file]Run the test report on the notebook:
report = TestReport[file]Get the test that tests $TestFileName:
result = report["TestResults"][8]Show the input, expected output and actual output for the test result:
result[{"Input", "ExpectedOutput", "ActualOutput"}]//DatasetSee Also
Tech Notes
Related Guides
History
Text
Wolfram Research (2019), $TestFileName, Wolfram Language function, https://reference.wolfram.com/language/ref/$TestFileName.html.
CMS
Wolfram Language. 2019. "$TestFileName." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$TestFileName.html.
APA
Wolfram Language. (2019). $TestFileName. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$TestFileName.html
BibTeX
@misc{reference.wolfram_2026_$testfilename, author="Wolfram Research", title="{$TestFileName}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/$TestFileName.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_$testfilename, organization={Wolfram Research}, title={$TestFileName}, year={2019}, url={https://reference.wolfram.com/language/ref/$TestFileName.html}, note=[Accessed: 13-June-2026]}