Difference between revisions of "Documentation/Nightly/SlicerApplication/QtTesting"

From Slicer Wiki
Jump to: navigation, search
m (Text replacement - "\[http:\/\/www\.slicer\.org\/slicerWiki\/index\.php\/([^ ]+) ([^]]+)]" to "$2")
 
(58 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Overview=
+
<noinclude>{{documentation/versioncheck}}</noinclude>
 
 
 
{|width="100%"
 
{|width="100%"
 
|
 
|
 
__TOC__
 
__TOC__
 
 
|align="right"|
 
|align="right"|
[[File:SlicerPlayer.gif|450px|Slicer QtTesting]]
+
[[Image: 3DSlicerQtTesting.png]]
 
|}
 
|}
 +
=Overview=
 +
 +
Too lazy to do the same actions over and over? QtTesting is the answer! The QtTesting library provides you with an easy way to record and play macros with 3DSlicer. Included in this library is a user-friendly recording interface that shows you what actions you're recording as well as a simple and smart playback interface that will allow you to control actions whenever you want. With no input from the user, QtTesting record all accomplished actions from the point you have started the record until you stop it! "Create a puppet and let it do the rest ... "
 +
 +
Slicer developers use this library to record tutorials and test the 3D Slicer application. How to create you own [[Documentation/Nightly/Developers/QtTesting|QtTesting test]]. <br>
 +
 +
 +
[[Image: QtTestingMenu.png]]
 +
 +
{{ambox
 +
| text = ''QtTesting is an effort started by the [http://paraview.org/Wiki/Testing_design ParaView team]''
 +
}}
  
Lazy to do the same actions over and over, QtTesting is the answer ! This library provides Slicer3D to record and play macros, by the easiest way. A easy record interface to show you, on time, what you are recording, and a simple and smart player to control how you want to play back your script. QtTesting records all accomplished actions, since you have started the record until you stopped it, without any inputs from the user ! "Create a puppet and let it do it the rest ... "
+
==Activate QtTesting==
 
 
Slicer developers already use this library to record tutorials and test Slicer3D application.
 
  
 +
{|width="100%"
 +
|valign="top"|
 +
By default, QtTesting is not activated. You must enable it to be able to record or play a saved macro.
 +
* Open the [[Documentation/{{documentation/version}}/SlicerApplication/ApplicationSettings|Application Settings]] dialog.
 +
* On the left side, select the ''QtTesting'' panel
 +
* Enable QtTesting by toggling the checkbox
 +
* Restart Slicer
 +
|align="right"|
 +
[[Image: QtTestingSettigns.png |450px]]
 +
|}
  
[[Image: QtTestingRecorderMenu.jpg |250px]]|
 
  
 
==Recorder==
 
==Recorder==
 
+
Recording a macro consists in observing all the high level events (or low level in some cases) that the user generate by interacting with the GUI elements. All the events are saved into a file (.xml) that can be used later to [[#Player|replay]] the recorded events in the same or different instance of the Slicer application.
 
{|width="100%"
 
{|width="100%"
 
|
 
|
=== How to Start ===
+
=== How to record a macro===
* Go to Edit and click to the action Record Macro to start to record all your events.
+
* From the [[Documentation/{{documentation/version}}/SlicerApplication/MainApplicationGUI#Application_Menu|menu bar]], open the ''Edit'' menu and select the ''Record Macro'' item to start recording all your following events.
''The record dialog will appear at the bottom left of the application''
+
''A record dialog appears at the bottom left of the application''
  
=== Record dialog : ===
+
=== Record dialog ===
* Show you the last event recorded
+
* Shows the last event recorded
 
* Numbers of events recorded
 
* Numbers of events recorded
'' You can now stop the record when you want by clicking on the Stop button''
+
* ''You can stop the recording anytime by clicking on the Stop button''
  
=== Save your macro ===
+
=== Save macro ===
* After stopped the record, a dialog will appear to allow you to save your macro.
+
* When the recording is stopped, a dialog shows up to ask where to save the recorded macro file.
  
 
|align="right"|
 
|align="right"|
[[Image: QtTestingRecorderDialog.jpg |300px]]|
+
[[Image: QtTestingRecorderDialog.jpg |300px]]
 
|}
 
|}
 +
  
 
==Player==
 
==Player==
 +
Recorded macros (.xml) can be replayed within Slicer sessions. Note that the success of the macro execution can depend on the original state of the application.
  
 
{|width="100%"
 
{|width="100%"
 
|
 
|
=== How to Start ===
+
=== How to play a macro ===
* Go to Edit and click to the action Play Macro to start to play back.
+
# From the [[Documentation/{{documentation/version}}/SlicerApplication/MainApplicationGUI#Application_Menu|menu bar]], open the ''Edit'' menu and select the ''Play Macro'' item to open the player dialog.
 +
# Choose the xml macro that you want to play
 +
# Press the "Play" button to start executing the macro
 +
 
 +
Slicer will ask if you want to restore the previously recorded settings. See [[Documentation/{{documentation/version}}/SlicerApplication/QtTesting#Default_settings_recorded|below]]
  
=== Player dialog : ===
+
=== Player dialog ===
* '''Controler widget'''
+
*'''Controller widget'''
** Start, pause, stop or play by step your macro.
+
** Play, pause, stop or play-step-by-step your macro.
** Log check button, allow you to Show/Hide messages about events.
+
** ''Logs'' check button shows/hides information about played events and errors if any.
** Change the Time step to control the speed.
+
** ''Time step'' controls the playback speed by waiting Xms before playing each event.
  
* '''Player tab :''' ''Default tab''
+
* '''Player tab''' (''default tab'')
** Show you the macro file played.
+
** Show the macro file played.
  
 
* '''Info tab''' :
 
* '''Info tab''' :
** SHow you the last event played.
+
** Show the last event played.
 +
 
 +
===Default settings recorded===
 +
To limit playback problems, QtTesting records automatically some of the applications settings.
 +
* General settings :
 +
** The application's geometry
 +
** The application's state
 +
** The application's name
 +
** The application's version
 +
 
 +
* 3DSlicer settings :
 +
** The current layout
 +
** The current module
 +
 
 +
Before each play back, the application might have different current settings, QtTesting then asks if you want to restore the settings to the record application state. To maximize the chance of a successful playback, settings must be restored to set the application into a state as much as possible similar to when the macro was recorded.<br>
 +
{{ambox
 +
| type = speedy
 +
| small = left
 +
| text = It's strongly recommended to accept !
 +
}}
  
 
|align="right"|
 
|align="right"|
 +
[[image: QtTestintMenuPlayerback.png  | 250px]]
 +
 +
[[image: QtTestintMacroFileDialog.png  | 300px]]
 +
 
[[image: QtTestintPlayererDialog.jpg  | 300px]]
 
[[image: QtTestintPlayererDialog.jpg  | 300px]]
 +
 +
[[image: QtTestintRestoreSettingsDialog.png  | 300px]]
 
|}
 
|}
  
 
==User limitations==
 
==User limitations==
 +
 +
''QtTesting in 3DSlicer is still under [[Documentation/{{documentation/version}}/Developers/QtTesting|heavy development]], some events might not be recorded properly.''
 +
 +
===What is subject to not work :===
 +
* Some actions under submenus, mainly actions on widget.
 +
 +
===Work, but not perfectly:===
 +
* Shifts/offsets might happen when you recording events in the 3D views.

Latest revision as of 02:25, 27 November 2019

Home < Documentation < Nightly < SlicerApplication < QtTesting


For the latest Slicer documentation, visit the read-the-docs.


3DSlicerQtTesting.png

Overview

Too lazy to do the same actions over and over? QtTesting is the answer! The QtTesting library provides you with an easy way to record and play macros with 3DSlicer. Included in this library is a user-friendly recording interface that shows you what actions you're recording as well as a simple and smart playback interface that will allow you to control actions whenever you want. With no input from the user, QtTesting record all accomplished actions from the point you have started the record until you stop it! "Create a puppet and let it do the rest ... "

Slicer developers use this library to record tutorials and test the 3D Slicer application. How to create you own QtTesting test.


QtTestingMenu.png

Activate QtTesting

By default, QtTesting is not activated. You must enable it to be able to record or play a saved macro.

  • Open the Application Settings dialog.
  • On the left side, select the QtTesting panel
  • Enable QtTesting by toggling the checkbox
  • Restart Slicer

QtTestingSettigns.png


Recorder

Recording a macro consists in observing all the high level events (or low level in some cases) that the user generate by interacting with the GUI elements. All the events are saved into a file (.xml) that can be used later to replay the recorded events in the same or different instance of the Slicer application.

How to record a macro

  • From the menu bar, open the Edit menu and select the Record Macro item to start recording all your following events.

A record dialog appears at the bottom left of the application

Record dialog

  • Shows the last event recorded
  • Numbers of events recorded
  • You can stop the recording anytime by clicking on the Stop button

Save macro

  • When the recording is stopped, a dialog shows up to ask where to save the recorded macro file.

QtTestingRecorderDialog.jpg


Player

Recorded macros (.xml) can be replayed within Slicer sessions. Note that the success of the macro execution can depend on the original state of the application.

How to play a macro

  1. From the menu bar, open the Edit menu and select the Play Macro item to open the player dialog.
  2. Choose the xml macro that you want to play
  3. Press the "Play" button to start executing the macro

Slicer will ask if you want to restore the previously recorded settings. See below

Player dialog

  • Controller widget
    • Play, pause, stop or play-step-by-step your macro.
    • Logs check button shows/hides information about played events and errors if any.
    • Time step controls the playback speed by waiting Xms before playing each event.
  • Player tab (default tab)
    • Show the macro file played.
  • Info tab :
    • Show the last event played.

Default settings recorded

To limit playback problems, QtTesting records automatically some of the applications settings.

  • General settings :
    • The application's geometry
    • The application's state
    • The application's name
    • The application's version
  • 3DSlicer settings :
    • The current layout
    • The current module

Before each play back, the application might have different current settings, QtTesting then asks if you want to restore the settings to the record application state. To maximize the chance of a successful playback, settings must be restored to set the application into a state as much as possible similar to when the macro was recorded.

QtTestintMenuPlayerback.png

QtTestintMacroFileDialog.png

QtTestintPlayererDialog.jpg

QtTestintRestoreSettingsDialog.png

User limitations

QtTesting in 3DSlicer is still under heavy development, some events might not be recorded properly.

What is subject to not work :

  • Some actions under submenus, mainly actions on widget.

Work, but not perfectly:

  • Shifts/offsets might happen when you recording events in the 3D views.