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")
 
(38 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"|
 
[[Image: 3DSlicerQtTesting.png]]
 
[[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 ... "
 
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 already use this library to record tutorials and test Slicer3D application.
+
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]]
 
[[Image: QtTestingMenu.png]]
  
==Activate QtTesting within 3DSlicer==
+
{{ambox
 +
| text = ''QtTesting is an effort started by the [http://paraview.org/Wiki/Testing_design ParaView team]''
 +
}}
 +
 
 +
==Activate QtTesting==
  
 
{|width="100%"
 
{|width="100%"
|
+
|valign="top"|
* Go to the setting panel within Slicer
+
By default, QtTesting is not activated. You must enable it to be able to record or play a saved macro.
* Go to the tab QtTesting
+
* Open the [[Documentation/{{documentation/version}}/SlicerApplication/ApplicationSettings|Application Settings]] dialog.
* Activate QtTesting
+
* On the left side, select the ''QtTesting'' panel
 +
* Enable QtTesting by toggling the checkbox
 +
* Restart Slicer
 
|align="right"|
 
|align="right"|
 
[[Image: QtTestingSettigns.png |450px]]
 
[[Image: QtTestingSettigns.png |450px]]
 
|}
 
|}
 +
  
 
==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 ===
 
* Shows the last event recorded
 
* Shows the last event recorded
 
* Numbers of events recorded
 
* Numbers of events recorded
'' You can stop the recording at anytime by clicking on the Stop button''
+
* ''You can stop the recording anytime by clicking on the Stop button''
  
=== Save your macro ===
+
=== Save macro ===
* When the recording is stopped, a dialog shows up to ask where to save the recorded 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==
Line 52: Line 59:
 
{|width="100%"
 
{|width="100%"
 
|
 
|
=== How to Start ===
+
=== How to play a macro ===
* Go to Edit and click to the menu item ''Play Macro'' to open the player dialog.
+
# 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 ===
* '''Controller widget'''
+
*'''Controller widget'''
 
** Play, pause, stop or play-step-by-step your macro.
 
** Play, pause, stop or play-step-by-step your macro.
 
** ''Logs'' check button shows/hides information about played events and errors if any.
 
** ''Logs'' check button shows/hides information about played events and errors if any.
Line 66: Line 77:
 
* '''Info tab''' :
 
* '''Info tab''' :
 
** Show 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 development, and some events won't be recorded or not properly.''
+
''QtTesting in 3DSlicer is still under [[Documentation/{{documentation/version}}/Developers/QtTesting|heavy development]], some events might not be recorded properly.''
  
'''Following what is subject to not work :'''
+
===What is subject to not work :===
* Some actions under submenu, mainly actions on widget.
+
* Some actions under submenus, mainly actions on widget.
  
'''work not perfectly:'''
+
===Work, but not perfectly:===
* A shift appear when you are using the 3D interactor.
+
* 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.