Previous: Compression and Encryption, Up: The ARTE RTA Test Files
TCL is a powerful language, at least for the requirements of ARTE. The following examples show the basic functionality of the ARTE Core without needeing any extra Plugin to extend the TCL interpreter's default dictionary.
fail
command).
#test1.tcl # Set test title... settitle "Dummy test which will always fail" # Print a debug message... debug "And show log..." # And force the test to fail fail "Message shown if failed" |
#test2.tcl # Set test title... settitle "Dummy test which will always pass" # Print a debug message... debug "More logs..." |
failifdifferent
and failifequal
, which compare two given strings.
#test3.tcl # Set test title... settitle "Dummy test which will also fail comparing strings" # Print a debug message... debug "And show another log here..." # Compare two strings and fail if they are different (they will # be the same here) failifdifferent "str" "str" "Message shown if failed" # Compare two strings and fail if they are equal (they will # be different here) failifequal "str" "nostr" "Message shown if failed" # Compare two strings and fail if they are different (they will # be different here, so this will be the failure point) failifdifferent "str" "nostr" "Message shown if failed" |
As the interpreter is a complete TCL interpreter, plus some customized commands,
you can use whatever TCL allows you. TCL can treat outputs from commands as
strings, and using the built-in failifdifferent
or failifequal
commands, you can control wether a test correctly passed or not.
Also, when your test has multiple places where it may fail (like ‘test3.tcl’), you can always add an extra last string to the command, which will be included in the reports generated by ARTE, to know the exact failure point.
If, for whatever reason, you need another new magic command to be built in the TCL interpreter of ARTE, you can easily implement it creating a new plugin and exporting the new ‘PLUGIN Dictionary’ (see Exporting the plugin dictionary)