User Defined Menu Items: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
(8 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 19: Zeile 19:
To add your own menu function, perform the following steps:
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")
* create a folder in the left item tree and give it a useful name (such as "''Custom Menu Functions''")
[[Datei:CreateCustomMenu1.png]]
[[Datei:CreateCustomMenu1.png]]
* create action blocks there. The blocks should not have any input pins. For a first example, simply create a compound action that opens a confirmation dialog.
* create action blocks there. The blocks should not have any input pins. For a first example, simply create a compound action that opens a confirmation dialog.
Zeile 27: Zeile 27:
[[Datei:CreateCustomMenu3.png]]
[[Datei:CreateCustomMenu3.png]]
* drag the folder (Custom Menu Operations) into the "GUI-Extensions"-"Operation Menu" field.
* drag the folder (Custom Menu Operations) into the "GUI-Extensions"-"Operation Menu" field.
And "Accept" the change (click on "Accept").
And "''Accept''" the change (click on "Accept").


[[Datei:CreateCustomMenu4.png]]
[[Datei:CreateCustomMenu4.png]]
Zeile 47: Zeile 47:
You can also send trace messages to the Transcript or Stdout.
You can also send trace messages to the Transcript or Stdout.
Sorry, but breakpoints on an activity step or single stepping are currently not possible for an action started via the menu.
Sorry, but breakpoints on an activity step or single stepping are currently not possible for an action started via the menu.
We recommend to first test the action in a regular "Test/Demo" page.
<br>We recommend to first test the action in a regular "Test/Demo" page.


=== Useful Building Blocks for Custom Menu Operations ===
=== Useful Building Blocks for Custom Menu Operations ===
Zeile 70: Zeile 70:
=== Organizing the Custom Menu ===
=== Organizing the Custom Menu ===


By default, custom menu operations are shown in the "Extra Menu", one menu item per action block found in the folder.
By default, custom menu operations are shown in the "''Extra Menu''", one menu item per action block found in the folder.
If the list becomes longer, it should be organized into a hierarchical list of submenu items.
If the list becomes longer, it should be organized into a hierarchical list of submenu items.


Zeile 82: Zeile 82:
If you prefer a separate "Operations" top-menu item, check the "''In Top Menu''" toggle, beside the operation folder field in the test suite's "Misc" page.
If you prefer a separate "Operations" top-menu item, check the "''In Top Menu''" toggle, beside the operation folder field in the test suite's "Misc" page.


Then, custom operations get their own top-level menu and will not be shown in the "Extra" menu. (notice that older expecco versions seem to have a little bug, in that the new top-level menu will only appear in new windows. There, you have to open a new window (via the main menu), then close the previous window.
Then, custom operations get their own top-level menu and will not be shown in the "Extra" menu.
<br>(notice that older expecco versions seem to have a little bug, in that the new top-level menu will only appear in new windows. There, you have to open a new window via the main menu, then close the previous window).


=== Including Menu Operations from Imported Libraries ===
=== Including Menu Operations from Imported Libraries ===
Zeile 90: Zeile 91:
=== Asynchronous (Background) Actions ===
=== Asynchronous (Background) Actions ===


By default, custom menu actions are blocking. This means that the UI is not responding while the menu operation is being executed. This is OK for typical operations as listed above, but is inconvenient if the menu operation is itself a long time running operation.
By default, custom menu actions are blocking. This means that the expecco UI is not responding while the menu operation is being executed. This is OK for typical operations as listed above, but is inconvenient if the menu operation is itself a long time running operation.


It is especially inconvenient if the operation consists of a daemon process, for example to simulate a communication partner, a web service, a monitor or other task, which has to run in parallel with the test execution.
It is especially inconvenient if the operation consists of a daemon process, for example to simulate a communication partner, a web service, a monitor or other task, which has to run in parallel with the test execution.
Zeile 112: Zeile 113:


Background actions are always terminated, when the last expecco window is closed (they are lightweight threads, and will not stay alive after the expecco session).
Background actions are always terminated, when the last expecco window is closed (they are lightweight threads, and will not stay alive after the expecco session).

=== Killing (Background) Actions ===
Either kill all Background actions via the "''Extras''" &#8594; "''Debugging''" &#8594; "''Stop all Executions''" menu item, or open a process monitor ("''Extras''" &#8594; "''Debugging''" &#8594; "''Process Monitor''"), find an individual background action's process in the list and terminate it there.

Version vom 13. Februar 2020, 15:24 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.

This 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, simply create a compound action that opens a confirmation dialog.
  • give the block a useful name - the name of the block will later be shown as the label of the menu item.

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 breakpoints on an activity step or single stepping are currently not possible for an action started via the menu.
We recommend to first test the action 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. Many of which were inspired by concrete customer needs. You will find action blocks 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 (which is useful to generate stub-testcases from an imported requirements list).

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

The following example action is found in the reflection library:

ExampleEditInExternalEditor.png

the corresponding menu function can be invoked while editing an activity diagram, with an attachment step being selected. (I.e. it saves the navigation to the attachment item, the click on the edit button, the click on accept in the attachment editor, and navigating back to the diagram). If that is a kind of operation that you have to perform many times per day, you will certainly appreciate that.

Organizing the Custom Menu[Bearbeiten]

By default, custom menu operations are shown in the "Extra Menu", one menu item per action block found in the folder. If the list becomes longer, it should be organized into a hierarchical list of submenu items.

For this, add sub-folders to the "Custom Menu Functions" folder, and group the operations as required. The custom menu will follow the folder structure.

Dummy action items named "-" and "=" will generate grouping lines to the menu.

Getting a Separate Menu[Bearbeiten]

If you prefer a separate "Operations" top-menu item, check the "In Top Menu" toggle, beside the operation folder field in the test suite's "Misc" page.

Then, custom operations get their own top-level menu and will not be shown in the "Extra" menu.
(notice that older expecco versions seem to have a little bug, in that the new top-level menu will only appear in new windows. There, you have to open a new window via the main menu, then close the previous window).

Including Menu Operations from Imported Libraries[Bearbeiten]

Check the toggle labelled "Include Imported Menus".

Asynchronous (Background) Actions[Bearbeiten]

By default, custom menu actions are blocking. This means that the expecco UI is not responding while the menu operation is being executed. This is OK for typical operations as listed above, but is inconvenient if the menu operation is itself a long time running operation.

It is especially inconvenient if the operation consists of a daemon process, for example to simulate a communication partner, a web service, a monitor or other task, which has to run in parallel with the test execution. Of course, it is always possibly to open another expecco window, and execute such an action in the second window, but this will lead to a number of blocked expecco windows being present.

To make a custom operation execute in the background (i.e. in parallel) without a need for a second window, place an ampersand character ("&") behind the action's name (e.g. rename the action to something like "Start Foo&". Then, when selected via the menu, the action will be started as a background task, and expecco will immediately return from the menu action.

The background task will run until explicitly terminated via one of:

  • the "Extras" → "Debugging" → "Stop all Executions" menu item,
  • the "Extras" → "Debugging" → "Stop Background Menu Action" menu item,
  • the process monitor, which is opened by the "Extras" → "Tools" → "Process Monitor" menu item.

If you load another test suite or close the browser window, with active background actions, two possible actions are taken by expecco:

  • if there is another expecco window on the same test suite, the other window will "adopt" those background actions and behave as if they were started by it. You can then control them via its debugging menu.
  • if no other window is open on the same suite, you will be asked if the background actions are to be terminated.

The process monitor will always show all background actions in the system - regardless from which window they were started. Therefore, in any case, these can always be terminated at any time via this tool.

Background actions are always terminated, when the last expecco window is closed (they are lightweight threads, and will not stay alive after the expecco session).

Killing (Background) Actions[Bearbeiten]

Either kill all Background actions via the "Extras" → "Debugging" → "Stop all Executions" menu item, or open a process monitor ("Extras" → "Debugging" → "Process Monitor"), find an individual background action's process in the list and terminate it there.



Copyright © 2014-2024 eXept Software AG