Selftest plugin: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „The plugin runs selftest scripts on acitions of a library. Each action has associated to it a test script which specifies the inputs and expected behavior of t…“)
 
Zeile 11: Zeile 11:
Currently, there are 5 different commands:
Currently, there are 5 different commands:


* "in ..."<br>specifies the input value(s) to be given to the action
* "in <expr1> . <expr2> ..."<br>specifies the input value(s) to be given to the action. Any number of expressions (incl. zero) can be given.
* "out" ..."<br>specifies the expected output value(s)
* "out" <expr1> . <expr2> ..."<br>specifies the expected output value(s). Any number of expressions (incl. zero) can be given.
* "run" ..."<br>runs the test setup (given by previous in & out commands) and verifies the outcome
* "run" <expectedOutcome>"<br>runs the test setup (given by previous in & out commands) and verifies the outcome. The outcome must empty (expect success) or one of "fail", "error", "inconclusive".
* "prerequisite" ...<br>a prerequistite for the action, to be executed before the test run
* "prerequisite" <st-expression><br>a prerequistite for the action, to be executed before the test run. "st-expression" must be a valid Smalltalk expression (which is given to eval).
* "cleanup" ...<br>a cleanup action to be executed after the test run
* "cleanup" <st-expression><br>a cleanup action to be executed after the test run. "st-expression" must be a valid Smalltalk expression (which is given to eval).


==== "in" Command ====
==== "in" Command ====
Zeile 40: Zeile 40:
Defines a Smalltalk expression to be evaluated AFTER the test run is executed.
Defines a Smalltalk expression to be evaluated AFTER the test run is executed.
A typical use is the deletion of a temporary file (eg. when testing the "File [exists]" action block.
A typical use is the deletion of a temporary file (eg. when testing the "File [exists]" action block.



=== Sample Script ===
=== Sample Script ===

Version vom 21. April 2018, 08:09 Uhr

The plugin runs selftest scripts on acitions of a library. Each action has associated to it a test script which specifies the inputs and expected behavior of the action. The script's syntax is very simple and scripts can easily be created from a requirements or certification document.

Its main use is as input for a certification suite of expecco's standard library.

Script Syntax[Bearbeiten]

The script consists of individual commands, each containing a textual command. Currently, there are 5 different commands:

  • "in <expr1> . <expr2> ..."
    specifies the input value(s) to be given to the action. Any number of expressions (incl. zero) can be given.
  • "out" <expr1> . <expr2> ..."
    specifies the expected output value(s). Any number of expressions (incl. zero) can be given.
  • "run" <expectedOutcome>"
    runs the test setup (given by previous in & out commands) and verifies the outcome. The outcome must empty (expect success) or one of "fail", "error", "inconclusive".
  • "prerequisite" <st-expression>
    a prerequistite for the action, to be executed before the test run. "st-expression" must be a valid Smalltalk expression (which is given to eval).
  • "cleanup" <st-expression>
    a cleanup action to be executed after the test run. "st-expression" must be a valid Smalltalk expression (which is given to eval).

"in" Command[Bearbeiten]

Specifies input values as Smalltalk expressions separated by a period ("."). For unconnected inputs, individual expressions can be left empty. For example:

  • in 1 . 2 . 3
    Provides 3 integer input values to the first 3 input pins, with values "1", "2" and "3" respecitvely.
  • in 1 . . 'abc'
    Provides the integer "1" to the first input pin, no values to the second and third input pin, and the string "abc" to the fourth input pin.
  • in
    no input values are provided

"out" Command[Bearbeiten]

Similar to the above "in" command, this defines the expected output values. For pins where no output is expected, empty expressions must be given.

"run" Command[Bearbeiten]

"prerequisites" Command[Bearbeiten]

Defines a Smalltalk expression to be evaluated BEFORE the test run is executed. A typical use is the creation of a temporary file (eg. when testing the "File [exists]" action block.


"cleanup" Command[Bearbeiten]

Defines a Smalltalk expression to be evaluated AFTER the test run is executed. A typical use is the deletion of a temporary file (eg. when testing the "File [exists]" action block.

Sample Script[Bearbeiten]

The following sample script could used with the "Arith [ Sum ]" action: in # no inputs out # no outputs expected run error # expect an error (no inputs given)

in 1 . 2 # two inputs given out 3 # expected output run # no error expected



Copyright © 2014-2024 eXept Software AG