is an option to TestReport that specifies which function to use when evaluating tests.
TestEvaluationFunction
is an option to TestReport that specifies which function to use when evaluating tests.
Details
- The default value for TestEvaluationFunction is TestEvaluate.
Examples
open all close allBasic Examples (1)
By default, TestReport evaluates tests using TestEvaluate:
TestReport[TestCreate[1, 1]]Use Identity as TestEvaluationFunction to skip all tests in the TestReport:
TestReport[
TestCreate[1, 1],
TestEvaluationFunction -> Identity
]Applications (3)
Print all tests in the notebook without evaluating them:
TestReport[
TestCreate[1, 1],
TestEvaluationFunction -> Echo
]Print all tests in the notebook before evaluation and evaluate them:
TestReport[
TestCreate[1, 1],
TestEvaluationFunction -> Echo /* TestEvaluate
]Use Throw and Catch to stop the test suite when a test fails:
Catch @ TestReport[
{
TestCreate[1, 1],
TestCreate[1, 2]
},
TestEvaluationFunction -> Function @ With[
{test = TestEvaluate[#]},
If[
test["Outcome"] === "Success",
test,
Throw @ test
]
]
]Store in MetaInformation a "Skip" property that defines if a test needs to run:
tr = TestReport[{
TestCreate[
1, 1,
TestID -> "OtherPlatforms",
MetaInformation -> <|
"Skip" -> ! StringContainsQ[$SystemID, "Mac"]
|>
],
TestCreate[
1, 1,
TestID -> "MacOnly",
MetaInformation -> <|
"Skip" -> StringContainsQ[$SystemID, "Mac"]
|>
]
},
TestEvaluationFunction -> Function @ If[
TrueQ[#["MetaInformation"]["Skip"]],
#,
TestEvaluate[#]
]
]tr["Results"]See Also
Tech Notes
Related Guides
History
Text
Wolfram Research (2023), TestEvaluationFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/TestEvaluationFunction.html.
CMS
Wolfram Language. 2023. "TestEvaluationFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TestEvaluationFunction.html.
APA
Wolfram Language. (2023). TestEvaluationFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TestEvaluationFunction.html
BibTeX
@misc{reference.wolfram_2026_testevaluationfunction, author="Wolfram Research", title="{TestEvaluationFunction}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/TestEvaluationFunction.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_testevaluationfunction, organization={Wolfram Research}, title={TestEvaluationFunction}, year={2023}, url={https://reference.wolfram.com/language/ref/TestEvaluationFunction.html}, note=[Accessed: 15-June-2026]}