class %UnitTest.TestCacheScript extends %UnitTest.TestScript
Extends TestScript. Adds methods to test ObjectScript code.
This class compares a file called output.log to a file called reference.log.
- Create a new class that extends TestCacheScript called, for example, TestCacheScriptX and export it to your test directory.
- Create a file called script.txt in your test directory, containing ObjectScript code you want to test. Here's an example:
w "abc" w $p("abc,xyz",",",Z)
- Run the test.
Each line of code in script.txt is executed and command output is written to reference.log until the end of file in script.txt is reached. The first time that you run the test, set the third argument as "reference" (lowercase and in double quotes) to create a reference.log file. (Use "screen" as the third argument to display output on the screen.) Check that the contents of new reference.log file are correct.
- Run the test again
classmethod runScript(scriptfile As %String, outputfile As %String)
Override this method with an implementation that reads from scriptfile, writing the output to outputfile. The output should be repeatable for a given script; not dependent on, e.g., the time or the system under test.