DiagramElements-Step/en

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen

Introduction[Bearbeiten]

A step is an action block which is placed into (instantiated in) an activity diagram. When a step is triggered (usually by receiving its required data at its input pins), an activity is created, which performs the action of block.

Notice, that multiple different steps can be (and often are) active at the same time. This happens when new data is arriving at a step's input, before the other activity has finished. If the parallelism is not limited, another activity will be triggered.

Note also, that multiple activities can even execute the same step in parallel, if it is triggered multiple times AND has been configured to operate in parallel.

In workflow literature, the terms Activity and Action are used in the same tenor. However, in UML literature the terms "Action", "Activity" and "Step" are unfortunately used inconsistently. The expecco documentation strictly separates between "Action block" (= action definition), "Step" (= placed block) and "Activity" (= executed step). Please note that an action block can be placed (instantiated) several times as a step and multiple activities could be actively executing the same step's action.

Schema: Outside View of an Action
Schema: Inside View of an Elementary Action
Schema: Inside View of a Compound Action
Placed as a Step in another Compound Action
Attachment Step in a Compound Action

Types of Steps[Bearbeiten]

Every step has an associated action definition, which is executed whenever the step is triggered. The internals of a step depend on how the action is defined. It may be an "elementary", "compound" or a builtin action.

Elementary actions are defined by a piece of code written in a number of programming languages.

Compound actions are described by an activity diagram consisting of a network of interconnected steps.

Finally, a small number of builtin actions is hardwired into expecco. Builtin actions are for example, "shell command action" steps, "remote procedure call" actions, "attachment steps" and "data generator" actions, for which no particular action definition or coding is required.

Regular Step[Bearbeiten]

Regular steps have a number of optional data and control inputs and a number of optional outputs. Each input and output is presented as a pin in the action's schema definition and also shown in the step. The block's schema definition can be seen as a template, which defines the outside picture of an action when placed as a step into an activity diagram.

Attachment Step[Bearbeiten]

Attachment steps are created when an attachment element is dragged from the tree into an activity diagram (or copy-pasted, or created via the "New Step" context menu dialog). These steps not have data inputs, but only provide a single output pin, at which the attachment's contents is presented when the step is triggered. Other than that, they behave like any other ordinary step. In fact, an attachment step could easily be simulated or reimplemented by an action which reads the file and passes the contents to its single output pin. So the attachment step is not adding any new feature, but can be seen as "syntactic sugar".

The output pin can be configured to present the attachment in a number of ways, depending on the need of the connected step.

By default, it will present the filename of the underlying attachment file as a pathname (a String). Be reminded that this can be different from the name of the element in the tree, to allow for the file to be replaced by another without affecting the suite's attachment steps.

This output pin's "data representation" can be configured via the step's or the pin's popup menu to one of:

  • Pathname
this is the default; the attachment's filename is presented as a pathname-String
  • Filename
the attachment's filename is presented as a filename object. These are similar to strings, but support a number of query operations to check for existence, attributes, size etc. of the file.
  • Unix Pathname
similar to the above "pathName" presentation, but as a Unix filename (with "/" as directory separators, instead of "\”). This is useful if you have to pass the filename to a script, possibly running on a remote Unix machine, or if you have to construct an URL from it.
  • URL
generates the URL. For FileAttachments, the filename is provided in URL-form as "file://....". The generated object is an instance of URL, which you may have to convert to a string, to be passed to other applications.
  • String
presents the whole contents of the file as one big string
  • UTF8-String
decodes any UTF-encoded characters and presents the whole contents of the file as one big string
  • Collection of Lines
presents the contents as one collection containing one string entry per line
  • Individual Lines
writes the output multiple times, presenting each line individually. A connected step will be triggered multiple times, once for every line in the file
  • Binary
presents the whole contents as one big array of bytes
  • Bitmap Image
decodes jpg, png, tiff, gif and other image formats and generates an instance of "Image"
  • Smalltalk Object
decodes a Smalltalk object (storeString-format) and generates any Object
  • JSON Object
decodes a JSON object and generates any Object (typically a Dictionary, which is a hash table-like object)
  • XML-Document
decodes XML and generates a document containing the DOM tree-
  • CSV-Document
decodes CSV and generates a list of row entries

Triggering a Step[Bearbeiten]

A step in an activity diagram gets triggered when its required input values are available at its input pins. The details for triggering are described in the pin documentation, and are controlled by the number and type of input pins. However, the vast majority of actions are declared with a simple and intuitive "All connected pins must have a value" as triggering condition (the so called "And-Connected Trigger Condition").

Actions with no input pins or where all input pins have constant "freeze values" usually have either the "Autostart" attribute, or are triggered via a special "Trigger Input" pin, which are both described below.

Special Attributes of a Step[Bearbeiten]

Autostart[Bearbeiten]

This attribute is used for steps which have no input pin for triggering, and for which no other external trigger input is available.

In traditional activity diagrams, this would be called the "Start" step, although in expecco, any step can be made a start step, and multiple such "autostarted" steps may be present within a single activity diagram. This simplifies the diagram, as no extra start step (which would provide no other semantic operation) is needed.
However, for those who prefer the traditional picture, a dummy "Start" action is also provided in the standard library.

In the diagram, autostarted steps are marked with a special "execute" icon at the top-left corner of the step's picture (in older expecco versions, and some screen shots in the documentation, this used to be a yellow lightning symbol, but has been replaced with a gear-wheel like icon, as it tended to be misread as an exception picture).

Ignore Exceptions[Bearbeiten]

By default, an exception or error condition arising during a step's execution leads to the termination of the step's activity, and unless handled, the exception is passed on to the caller activity. I.e. the step which is executing the faulty step's diagram is itself asked to handle the exception. This passing on of the exception continues until either the exception is handled via a step's exception pin or the step has been marked as "ignoring exceptions", or no outer calling activity is present (i.e. the test case which initiated the action is reached).

When a step ignores exceptions, it is terminated (and the optional exception output provides the exception information), but the diagram in which the faulting step is located is continued to be executed.

Cancel is OK[Bearbeiten]

Steps can be given a "Cancel Input Pin" which will cancel the step's activity when a value arrives at this pin. By default, a cancelled activity will trigger its exception-output pin, not its regular trigger-out pin. With the "Cancel is OK" flag set, a cancel is treated like a non-exceptional situation (i.e. it was expected to be cancelled) and the trigger output is written as usual (and no exception output is written).

Skipped Execution[Bearbeiten]

Individual steps in a diagram can be skipped by setting the "Skipped Execution" attribute. Such steps will not read any input data, not execute any action and will not write to any data output pin.

However, the trigger output pin gets a value if present and connected. Therefore, steps in a control flow (i.e. only connected via Trigger-Input/Trigger-Output pins) can be skipped without a need to short-circuit their control pins. Of course, as skipped pins do not generate any data output, any step which requires those output values would not be triggered.

Skipping steps is mostly used when debugging test activities or to skip over long running initial steps when an activity needs to be restarted after a change. They are usually not used after the test development process, in a production test suite.

Suppress Log[Bearbeiten]

These attribute suppress the activity log as normally generated either unconditionally or conditionally on a per-step basis during execution. For helper actions, which are of no interest, or steps which produce huge amounts of output, which is not actually required, setting this attribute both reduces the test's execution time and the amount of logging data that is generated.

For very long running tests (hours or days), it is recommended to use this attribute to ensure that the activity log fits the machine's memory size (to avoid running out of memory during the test run).

You can either unconditionally disable the activity log for a step or its subactivities or conditionally, based on its outcome, or if it is part of a loop.

Augmenting the Step's Name in the Log[Bearbeiten]

If a step's name contains the substring "%i", where i is a number from 1 to the number of input pins, the name is expanded by including the corresponding input pin's value-string in the activity log. I.e. if the input pin received a value of (say) 1234, then the step name "My Step (test data is %1)" will be shown as "My Step (test data is 123)".

In addition, the following expansions are possible:

  •  %(START) - expands to the step's execution start timestamp
  •  %(END) - expands to the step's execution end timestamp
  •  %(STATE) - expands to the step's outcome (fail, error, passed, inconclusive)

This has no effect on the step's operation; it only affects the generated activity log/test report.

Auto-Closing of Interactive Dialog Actions[Bearbeiten]

If your suite contains interactive GUI dialog steps (eg. "Dialog [Confirm]" and similar), you may want them to either close automatically iff the suite is to executed without human supervision, or if the human operator does not confirm the dialog within some time.

For this, add a timeout (say 5 seconds), and set one of the "Ignore Exceptions" or the "Timeout is OK" flags of the step. Of course, you should then decide if the timeout should be interpreted as confirmation or as rejection, by continuing execution along either the "Trigger-out" or the "Exception-out" pin.

See Also[Bearbeiten]

Block Element, Activity, Pin, Connection



Copyright © 2014-2024 eXept Software AG