User Defined Menu Items: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
Zeile 67: Zeile 67:
and how to auto-generate complex activity blocks.
and how to auto-generate complex activity blocks.


==== Example Using the Reflection Library: Edit Attachment in External Editor ====

The following example action is found in the reflection library:

[[Datei:ExampleEditInExternalEditor.png]]


[[Category: Incomplete]]
[[Category: Incomplete]]

Version vom 26. Juni 2015, 12:09 Uhr

You can add your own custom menu items to expecco's main menu, and connect them to an action which is executed, when the menu item is selected.

Thus is very useful to automate common tasks, such as setup/shutdown of test systems, perform configurations, create test data etc.

Useful Operations of a Custom Menu[Bearbeiten]

The following is a partial list of what can and has been done with this feature in the past (by customers):

  • Startup / Shutdown of the System Under Test (usually blocks which execute shell scripts)
  • Startup / Shutdown of Java Bridge connections
  • Creation of test data files
  • Creation of attachments in the item tree
  • Extracting an attachment's contents and opening an external editor on it
  • Opening a Java GUI on an attachment's contents via the Java Bridge
  • Bulk generation of empty TestCase templates from an imported CSV file

Defining a Custom Menu Operation[Bearbeiten]

To add your own menu function, perform the following steps:

  • create a folder in the left item tree and give it a useful name (such as "Custom Menu Functions")

CreateCustomMenu1.png

  • create action blocks there. The blocks should not have any input pins. For a first example, sinply create a compound action, which opens a confirmation dialog.
  • give the block a useful name - the block's name will later be shown as the menu item's label.

CreateCustomMenu2.png

  • navigate to the testsuite's "Misc" page

CreateCustomMenu3.png

  • drag the folder (Custom Menu Operations) into the "GUI-Extensions"-"Operation Menu" field.

And "Accept" the change (click on "Accept").

CreateCustomMenu4.png

You are now ready to use the new operation; you will find a new menu item named "Hello" in the "Extra" menu:

CreateCustomMenu5.png

which ,when selected, executes your "Hello" action:

CreateCustomMenu6.png

Debugging Custom Menu Operations[Bearbeiten]

Custom menu functions are harder to debug than regular action blocks, because when executed, there is no test/demo page, in which an activity-log is shown. By default, if any error occurs inside the menu operation, it is simply cancelled. A short error message is shown in the lower information area, though.

You can place a breakpoint in an elementary block, and enable the "Debug all Exceptions" flag in the "Execution Settings". You can also send trace messages to the Transcript or Stdout. Sorry, but currently, breakpoints on an activity step or single stepping are currently not possible. We recommend, that the action is first tested in a regular "Test/Demo" page.


Useful Building Blocks for Custom Menu Operations[Bearbeiten]

Because custom menu functions are used heavily by many customers, a library of useful operations ("Expecco Reflection Library") has been created and can be imported into your test suite.

This library contains many useful action blocks to interact with the running expecco itself. For example, to get a handle to the current editor, to add items to the tree or current diagram, to fetch or modify the text being edited etc.

You will also find a few more examples in this library, for example on how to open an external editor on a selected attachment, and how to auto-generate complex activity blocks.

Example Using the Reflection Library: Edit Attachment in External Editor[Bearbeiten]

The following example action is found in the reflection library:

ExampleEditInExternalEditor.png



Copyright © 2014-2024 eXept Software AG