Standard Library

From expecco Wiki (Version 2.x)
Jump to navigation Jump to search

Introduction[edit]

The StandardLibrary contains general domain-independent function blocks. These are useful for any kind of test-development.

One of the features which make the StandardLibrary very flexible is the dynamic type system of the underlying implementation language. This allows for action blocks to handle a wide range of possible input values. For example, arithmetic blocks ("Arith [ * ]") all allow for Integers, Floats, LargeIntegers, Fractions, FixedPoint-Decimals and Measurement Values to be used as input (where appropriate). And most of the collection blocks ("Collection [ * ]") can deal with Strings, ByteArrays, Buffer-Data, Arrays, OrderedCollections, Tuples, SortedCollections, Sets, HashTables (Dictionaries) and other collection types. Without such a dynamic type system, many more blocks would be needed for a comparable set of functions (see IEC1131, for example, which uses a similar execution model, but a static type system).

The automatic type conversion between Integer and LargeInteger (whenever a value cannot be represented within 32bit) and vice versa, and the automatic conversion of a quotient to a Fraction and the reduction back to an Integer avoid rounding errors and loss of precision.    

Back to Online Documentation

Numbers[edit]

Arithmetic[edit]

Bit Manipulation[edit]

Trigonometric[edit]

Misc Math[edit]

Modulu Arithmetic[edit]

Rounding & Truncation[edit]

Assertions, Exceptions & Logging[edit]

  • FAIL
    Report a Failure. This means, that the system under test failed a test.
  • FAIL2
    Report a Failure. This means, that the system under test failed a test. Optionally decorate the failure-message with pre-/postFix string.
  • ERROR
    Report an Error. This means, that something unexpected (an error) occurred in the expecco test suite itself. The test suite must be fixed.
  • ERROR2
    Report an Error. Optionally decorate the error-message with pre-/postFix string.
  • INCONCLUSIVE
    Report an Inconclusive state. This means, that we cannot tell, what the test result is.
  • INCONCLUSIVE2
    Report an Inconclusive state. Optionally decorate the message with pre-/postFix string.
  • PASS
    Report a Successful Test. This means, that the system under test passed the test.
  • PASS2
    Report a Successful Test. Optionally decorate the pass-message with pre-/postFix string.
  • OK
    Finish the current Activity and mark it as successful.
  • OK2
    Finish the current Activity and mark it as successful. Optionally decorate the success-message with pre-/postFix string.
  • ABORT
    Finish the current Activity and mark it as aborted.
  • HALT
    Stop end enter the debugger, but only if halts are not ignored in the settings.(1.9.1).
  • PAUSE
    Same effect as pressing the "Pause"-button: pauses the executor. Press "Run" or "Single Step", to continue (1.9.1).

Logging & Messages[edit]

Adding Log Entries[edit]

Info Messages[edit]

  • Information Message
    Show a message in the browser's info area (at the bottom). Useful to provide some progress-feedback to the test-operator. Notice: these messages are not persistent in the generated log report. (in contrast to the Log* blocks)
  • Information Message (Warning)
    Show a warning message in the browser's info area (at the bottom). Useful to provide some progress-feedback to the test-operator. Notice: these messages are not persistent in the generated log report. (in contrast to the Log* blocks)
  • Transcriber
    Displays its input string as a line in the Transcript window. If there is no open Transcript window, a new one will be opened. Useful to provide some feedback to the test-operator. Notice: these messages are not persistent in the generated log report. (in contrast to the Log* blocks)
  • Transcriber without CR
    Displays its input string in the Transcript window like the transcriber, but does not generate a newLine at the end. If there is no open Transcript window, a new one will be opened. Useful to provide some feedback to the test-operator. Notice: these messages are not persistent in the generated log report. (in contrast to the Log* blocks)
  • Show Transcript Window
    Ensure that a transcript window is visible. If there is no existing Transcript window, a new one will be opened.
  • Hide Transcript Window
    Ensure that a transcript window is invisible (iconified). If there is no existing Transcript window, this is a NO-Operation.
  • Clear Transcript Window
    Clears the transcript window. If there is no existing Transcript window, this is a NO-Operation (1.9.1).
  • Contents of Transcript
    Retrieves the contents of the transcript window as a collection of line-strings (1.9.1).
  • Log Start of Testcase on Transcript
    Generates a log message about a started testcase on the Transcript.
  • Log Finish of Testcase on Transcript
    Generates a log message about a finished testcase on the Transcript.

Assertions[edit]

Collections[edit]

Compare[edit]

Many compare blocks come in two versions: one which generates a true/false boolean value (the 1-way blocks) and another, which sends the result to one of two (or three) different outputs. The later are very useful to split the flow of control to different followup blocks (although that behaviour could also be simulated by using a 1-way compare followed by a pass-data block from the "misc" section).

Notice: these blocks allow for Numbers, Strings, Collections and some other types to be compared. However, for the order relation compare operations, the types must be compatible; you cannot mix Numbers with Strings or other there.

  • Compare [ 3-Way ]
    Sends a boolean "true" value to one of its three outputs: LESS, EQUAL or GREATER.
  • Compare [ Equal 2-Way ]
    Compare two values for equality; Send the first value to either the triggerYES or the triggerNO output.
  • Compare [ Less 2-Way ]
    If the input at in1 is less than in2, send it to the triggerYES output. Otherwise, send it to triggerNO.
  • Compare [ Equal ]
    Generate a true if in1 is equal to the input value2 in2; otherwise, generate a false.
  • Compare [ Less ]
    Generate a true if in1 is less than the input value2 in2; otherwise, generate a false.
  • Compare [ Greater ]
    Generate a true if in1 is greater than to the input value2 in2; otherwise, generate a false.

Data Generators[edit]

Data Types[edit]

Additional Datatypes. No description yet.

Event Queues[edit]

Contains support for asynchronous event handling. A sample suite is found in "demos/d62_Event_Queue_Demos.ets".

Overview[edit]

The general pattern consists of an event handler process, which runs as a separate thread and reads events from a so-called event queue. Whenever an event arrives, a handler action is selected and invoked to process the event. Handler actions are registered by eventType, which is a symbolic tag, attached to every event. Actions themself are defined as an expecco action (or JavaScript function or Smalltalk block), which must take a single input, the event to be processed.

The Global Event Handler[edit]

Although there might be any number of active event handler processes running, typical suites use a single common and globally known handler, which is started and initialized at the very beginning of a test run (eg. in a testplan's pre-action, or a suite's post-load-action).

There, individual actions should be registered for individual event types or an action for #default, to handle any other type of event.

Sending Events[edit]

Events can be generated either via regular action blocks, or via calls to the Activity API. The API is available both to internal elementary actions (i.e. Smalltalk and JavaScript actions), and to bridged (i.e. Node or Python) actions.

This makes it possible to communicate asynchronously from processes started inside a Node or Python server process. For example, a communication protocol reader, which may push events on incoming messages, to be processed asynchronously by an expecco action (eg. registered event handler action).

 

Files & Directories[edit]

Files[edit]

Queries[edit]

Creation[edit]

Directories[edit]

GUI-Dialogs[edit]

Inspecting & Debugging[edit]

  • Inspect
    Open an inspector window to show some datums contents.
  • Show Image
    Open an image viewer to show some image.
  • Edit Image
    Open a bitmap editor to allow some limited image manipulations.
  • Edit Color
    Open a color editor (useful to inspect picked web-page colors).

Support[edit]

Images[edit]

Logic[edit]

Misc[edit]

  • START
    Does nothing, can be used with autostart as a trigger.
  • JOIN
    When ALL inputs are available, continue.
  • Data Sink
    Consume (and throw away) any data from the input pin.
  • Data Source
    Pass its input to its output. Can be used to start a dataflow, if the input is frozen and the block is triggered via autoStart or the START node above.
  • Pass Data if True
    Used to conditionally pass data along a connection or to block/throw it away in other situations.
  • Pass Data if False
    Used to conditionally pass data along a connection or to block/throw it away in other situations.
  • Either - Or
    Passes one of two input values to the output (1.9.1).

Expecco Reflection[edit]

These provide info about the state of the tool and execution engine.


  • Current Testplan
    This block provides a handle to the currently executing testplan (1.9.1).
  • Current Testcase
    This block provides a handle to the currently executing testcase (1.9.1).

Reporting[edit]

  • Report [ Generate ]
    Generates a report in a specified format for the currently running test execution (1.7.2).

Virtual to Concrete Mapping[edit]

Resources[edit]

Networking & Interfacing[edit]

Checksums & Cryptography[edit]

FTP[edit]

HTTP[edit]

Server[edit]

IMAP[edit]

JSON[edit]

SMTP[edit]

Source Code Management[edit]

OS[edit]

String Processing[edit]

Comparing & Matching[edit]

Copying[edit]

Encoding[edit]

Padding & Formatting[edit]

Queries[edit]


Stream Input/Output[edit]

File Streams[edit]

Stream Reading[edit]

Socket Streams[edit]

Internal Streams[edit]

Stream Writing[edit]

Time & Date[edit]

  • Date [ GetDaysInYear]
    Get the number of days in the year which is represented by the given timestamp (365 or 366).

Tools[edit]

  • Windows [ Open Document ]
    Ask the Windows shell to open a document. Will start the application that is associated with the file type (1.9.1).

Type Conversion[edit]

  • Cast [ String To Any ]
    Convert a string-input to an any-output. Actually, no conversion is done here, this is a simple type cast.

Variables[edit]


Back to Online Documentation

Go to Release Notes



Copyright © 2014-2018 eXept Software AG