TestObject
TestObject[…]
gives an object that represents the results of a TestCreate.
Details

- TestObject is typically obtained as a result from TestCreate.
- TestObject[…]["prop"] returns the value of "prop" for a given TestObject.
- TestObject[…][{"prop1","prop2",…}] returns an association of values corresponding to several properties.
- TestObject[…]["Properties"] returns a list of all properties available.
- Possible properties for TestObject include:
-
"AbsoluteTime" absolute time the test was created, in UTC time zone "AbsoluteTimeUsed" absolute number of seconds in real time that have elapsed "ActualMessages" messages generated on evaluating input "ActualOutput" output generated on evaluating input "CPUTimeUsed" CPU time spent on evaluating input "Created" DateObject of creation time, in $TimeZone "ExpectedMessages" messages passed to the test "ExpectedOutput" evaluated expected output "Input" original test input "MemoryConstraint" original MemoryConstraint value "MemoryUsed" number of bytes used to store all data "Outcome" outcome on running the TestCreate "SameTest" original SameTest function "TestFileName" absolute file name of the currently executing test file "TestID" unique identifier for the test "TestKey" automatic key that is unique for every test "TimeConstraint" original TimeConstraint value "TestCreate" original TestCreate expression
Examples
open allclose allBasic Examples (2)
Run TestCreate to get a TestObject:
Use TestEvaluate to run the test:
Extract the original input and run the test again by using ReleaseHold:
Scope (1)
Extract several properties at once:
Extract all properties and present results in a Dataset:
Applications (1)
Use the "TestCreate" property to recreate the original test expression:
Use ReleaseHold to create a new one again:
Properties & Relations (19)
Properties (19)
"AbsoluteTime" (1)
Use "AbsoluteTime" to extract the creation time of the test in UTC:
Use FromAbsoluteTime to convert the value in a DateObject:
Use the "Created" property to get a DateObject in your time zone:
"AbsoluteTimeUsed" (1)
Use "AbsoluteTimeUsed" to extract the absolute number of seconds in real time that have elapsed:
The property returns a Missing if the TestObject was never evaluated:
"ActualMessages" (1)
Run a test that emits messages:
Use "ActualMessages" to extract all messages emitted during the evaluation of the test:
The expression is wrapped in HoldForm:
The property returns a Missing if the TestObject was never evaluated:
"ActualOutput" (1)
Use "ActualOutput" to extract the result of the input expression:
The expression is wrapped in HoldForm:
The property returns a Missing if the TestObject was never evaluated:
"CPUTimeUsed" (1)
Use "CPUTimeUsed" to extract the CPU time spent on evaluating the input:
The property returns a Missing if the TestObject was never evaluated:
"Created" (1)
"ExpectedMessages" (1)
Use "ExpectedMessages" to extract all messages expected during the evaluation of the input:
The expression is wrapped in HoldForm:
"ExpectedOutput" (1)
Use "ExpectedOutput" to extract the expected result:
The expression is wrapped in HoldForm:
"Input" (1)
Use "Input" to extract the original input expression:
The expression is wrapped in HoldForm:
"MemoryConstraint" (1)
Create a test that uses the MemoryConstraint option:
Use "MemoryConstraint" to extract the original value of the option:
"MemoryUsed" (1)
"MetaInformation" (1)
"Outcome" (1)
Use "Outcome" to extract the outcome of a test:
The test will give a "Failure" outcome if the "ActualOutput" does not match the "ExpectedOutput":
The test will give a "MessageFailure" outcome if the test succeeds but does not emit the specified list of "ExpectedMessages":
The test will give an "Error" outcome if the SameTest function does not return True or False:

"TestFileName" (1)
Run a test suite from a file or notebook:
Extract the first TestObject:
"TestKey" (1)
"TimeConstraint" (1)
"TestCreate" (1)
Use "TestCreate" to create a TestCreate expression from the object:
The expression is wrapped in HoldForm:
Text
Wolfram Research (2023), TestObject, Wolfram Language function, https://reference.wolfram.com/language/ref/TestObject.html.
CMS
Wolfram Language. 2023. "TestObject." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TestObject.html.
APA
Wolfram Language. (2023). TestObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TestObject.html