![]() |
T4S4
18.1 C7177 A20283
Teamcenter Gateway for SAP S/4HANA API Reference
|
Commands to work with the Test and Teach framework (TNT). More...
Namespaces | |
Assert | |
Commands to compare expected with actual results. They must only be called from within verify procedures. Call them without any namespace identifier. | |
DemoCase | |
Commands to retrieve information about the demo case currently being executed. They must only be called from within demo case namespaces. | |
DemoSuite | |
Commands to retrieve information about the demo suite currently being executed. They must only be called from within demo case namespaces. | |
Functions | |
canExecuteDemoSuite namespace ?optionsVar? | |
Test whether all preconditions defined in a demo suite are met. More... | |
executeDemoSuite namespace testResultsVar ?optionsVar? | |
Execute demo suite as a test. More... | |
executeTests args | |
Execute demo suite as a test (deprecated). More... | |
formatTestReport testResultsVar | |
Format the test results into a list of lines. More... | |
getNonGood testResultsIn | |
Returns the list of demo cases that did not complete with GOOD. More... | |
htmlCloseFile channel ?optionsVar? | |
Close an HTML file opened to receive the documentation to be generated through the htmlWriteLessons command. More... | |
htmlOpenFile htmlOutputFileName ?optionsVar? | |
Open an HTML file to receive the documentation to be generated through the htmlWriteLessons command. More... | |
htmlWriteLessons channel namespace patterns ?optionsVar? | |
Derive documentation from a demo suite and write it to an HTML file. More... | |
logTestReport testResultsVar ?logChannel? | |
Output test results using the tpwrite command. More... | |
putCode namespace patterns ?optionsVar? | |
Generate code for the test cases specified through the given patterns and output the code using the puts command. More... | |
putLessons namespace patterns ?optionsVar? | |
Output the title, lesson and code parts of demo suite using the puts command. More... | |
putOverview namespace patterns ?optionsVar? | |
Output the title, and code parts of demo suite using the puts command. More... | |
putTestReport testResultsVar | |
Output test results using the puts command. More... | |
Commands to work with the Test and Teach framework (TNT).
Formulate demo suites containing demo cases, similar to test suites and test cases, and feed them into the TNT using the commands in this namespace. The result will be the execution of the tests with a test report you can output or documentation in several formats.
The demo suites are specified as Tcl namespaces including subordinate namespaces for the demo cases. The demo case namespaces may include the following pieces:
precondition procedure - The code defined in this procedure is executed prior to executing the code to be tested. It must return a true
boolean if the the actual code can be executed or false
if it cannot. See Preconditions below. The code in a precondition procedure must not depend on results from code to be executed as a test.
Example:
true
this demo case will not be executed unlessTest results are recorded in the testResults
array the name of which is passed to the commands as a parameter. Demo cases are assigned so called four-letter-status-words out of the following:
The precondition procedures can be used to define preconditions that must be met before the code defined in the code procedures get executed. The canExecuteDemoSuite can then be called prior to running any test in order to check if there are unmet preconditions. This is for example useful to test if test data required to execute the demo suite is available. If it is not the test script may not even offer the possibility to execute the demo suite
For this to work the code in a precondition procedure must not depend on results from code to be executed as a test. Only then all precondition procedures can be executed to verify if the demo suite can be executed.
Read more (including examples) under also precondition proc and canExecuteDemoSuite command.
All procedures defined in a demo case such as code, precondition, verify or examples may contain placeholders of the form <%= SCRIPT%>. The SCRIPT is a piece of Tcl code that is executed when the code is retrieved from the body of the procedure. The result of the execution replaces the placeholder. This can be used for example to avoid code duplication.
If you want lines in the code procedure to not appear in the representation used for documentation purposes you can suppress them with the following markers:
The htmlWriteLessons command produces HTML output from text placed into lessons. The lessons are parsed by a simple markup processor that translates the markup into HTML elements.
The following markup elements are supported:
The value is 'true'
→ The value istrue
Click on *
File*
→ Click on File
This is called a <<demo case>>
→ This is called a demo case
Go to File –> New ...
→ Go to File → New ...
See ->FindBomHeader
→ See Find the header of a Bill Of Material (BOM)
-
-! Caution !
on a single line followed by any number of dashes marks the beginning of highlighted text. The end of the highlighted text is marked with a single line consisting of at least six dashes, e.g.: is rendered as
-
-! Caution !–—
NOTE THAT ...
---------------—
NOTE THAT ... |
(There are bugs in the Doxygen document generator that disallow displaying the HTML output here)
T4X::TestingSupport::canExecuteDemoSuite | namespace ?optionsVar? | ||
Test whether all preconditions defined in a demo suite are met.
If you are interested in more details you can use the executeDemoSuite command with the execute option set to false
and extract the details from the result array.
namespace | the Tcl namespace representing the demo suite |
optionsVar | (optional) name of an array variable from which to read further options. Supported options are given with the executeDemoSuite command. |
true
if all preconditions are met, false
if any is not met. References executeDemoSuite().
T4X::TestingSupport::executeDemoSuite | namespace testResultsVar ?optionsVar? | ||
Execute demo suite as a test.
If the optionsVar
parameter is given it is interpreted as the name of an array that may contain the following entries:
true
test if all preconditions are met and write the result into the preconditionsMet
field of the result array; defaults to false
.false
no demo case will be tested. This is used in conjunction with testPrecondition
to only check the preconditions.true
the code that is being tested will be output. This is useful to verify if the angle bracket expressions" are expanded in the expected way.namespace | the Tcl namespace representing the demo suite |
testResultsVar | name of an array variable into which the test result is recorded |
optionsVar | (optional) name of an array variable from which to read further options. Supported options are given above. |
References GetBool(), and XGet().
Referenced by canExecuteDemoSuite(), and executeTests().
T4X::TestingSupport::executeTests | args | ||
Execute demo suite as a test (deprecated).
namespace | the Tcl namespace representing the demo suite |
executionContext | namespace inside which the tests are executed |
testResultsVar | name of an array variable into which the test result is recorded |
patterns | (optional) list of patterns to be applied to the names of demo cases (the names of the namespaces) to select which demo cases to process. The string match command is used for this and case is ignored. |
References executeDemoSuite().
T4X::TestingSupport::formatTestReport | testResultsVar | ||
Format the test results into a list of lines.
testResultsVar | name of an array variable containing the test results as produced by the executeDemoSuite command. |
Referenced by logTestReport(), and putTestReport().
T4X::TestingSupport::getNonGood | testResultsIn | ||
Returns the list of demo cases that did not complete with GOOD.
T4X::TestingSupport::htmlCloseFile | channel ?optionsVar? | ||
Close an HTML file opened to receive the documentation to be generated through the htmlWriteLessons command.
channel | identifier representing the HTML file |
optionsVar | (optional) name of an array variable from which to read further options. Not used currently. |
T4X::TestingSupport::htmlOpenFile | htmlOutputFileName ?optionsVar? | ||
Open an HTML file to receive the documentation to be generated through the htmlWriteLessons command.
htmlOutputFileName | full path of the HTML file |
optionsVar | (optional) name of an array variable from which to read further options. Not used currently. |
T4X::TestingSupport::htmlWriteLessons | channel namespace patterns ?optionsVar? | ||
Derive documentation from a demo suite and write it to an HTML file.
channel | identifier representing the HTML file |
namespace | representing the demo suite |
patterns | (optional) list of patterns to be applied to the names of demo cases (the names of the namespaces) to select which demo cases to process. The string match command is used for this and case is ignored. |
optionsVar | (optional) name of an array variable from which to read further options. Not used currently. |
References PutTestSpecs(), and SetDefault().
T4X::TestingSupport::logTestReport | testResultsVar ?logChannel? | ||
Output test results using the tpwrite
command.
The log lines are assigned a message type according to the status of the tests.
testResultsVar | name of an array variable containing the test results as produced by the executeDemoSuite procedure. |
logChannel | (optional) identifier of the log file to write to. |
References formatTestReport(), and tpwrite().
T4X::TestingSupport::putCode | namespace patterns ?optionsVar? | ||
Generate code for the test cases specified through the given patterns and output the code using the puts
command.
The generated code may be copied into real mappings but may have to be reworked afterwards.
namespace | representing the demo suite |
patterns | (optional) list of patterns to be applied to the names of demo cases (the names of the namespaces) to select which demo cases to process. The string match command is used for this and case is ignored. |
optionsVar | (optional) name of an array variable from which to read further options. This command only interprets the executionContext option. Supported options are given with the executeDemoSuite command. |
References PutTitleWithPrefix(), and XGet().
T4X::TestingSupport::putLessons | namespace patterns ?optionsVar? | ||
Output the title, lesson and code parts of demo suite using the puts
command.
The demo cases are taken from the namespace from which this command is called.
If the optionsVar
parameter is given it is interpreted as the name of an array that may contain the following entries:
namespace | representing the demo suite |
patterns | (optional) list of patterns to be applied to the names of demo cases (the names of the namespaces) to select which demo cases to process. The string match command is used for this and case is ignored. |
optionsVar | (optional) name of an array variable from which to read further options. Supported options are given above. |
References PutTestSpecs().
T4X::TestingSupport::putOverview | namespace patterns ?optionsVar? | ||
Output the title, and code parts of demo suite using the puts
command.
If the optionsVar
parameter is given it is interpreted as the name of an array that may contain the following entries:
namespace | representing the demo suite |
patterns | (optional) list of patterns to be applied to the names of demo cases (the names of the namespaces) to select which demo cases to process. The string match command is used for this and case is ignored. |
optionsVar | (optional) name of an array variable from which to read further options. Supported options are given above. |
References PutTestSpecs().
T4X::TestingSupport::putTestReport | testResultsVar | ||
Output test results using the puts
command.
testResultsVar | name of an array variable containing the test results as produced by the executeDemoSuite procedure. |
References formatTestReport().