sct_testcase_12_refactor.textile 7.5 KB

12345678910111213141516171819202122
  1. h1. YAKINDU Statechart Tools – Testcase 12 - Refactoring
  2. |_. Nr |_. Testname |_. Test Instructions |_. Postconditions |_. Status|
  3. | 12.1 | Group states into composite | <ol><li><p>Select all states.</p></li><li><p>Right-click on one of the states, then select _Refactor → Group States Into Composite_.</p></li><li><p>Rename the new composite state to *LightSwitch*.</p></li></ol> | No errors occured. The states are wrapped in a composite state named *LightSwitch*. | %{color:red}open% |
  4. | 12.1.1 | Simulate | <ol><li><p>Save the statechart.</p></li><li><p>Run the simulation.</p></li></ol> | The behavior of the refactored model is equivalent to its behavior before refactoring. The composite state *LightSwitch* is active and highlighted (yellow). | %{color:red}open% |
  5. | 12.2 | Extract subdiagram | <ol><li><p>Right-click on the edge or on the title area of the *LightSwitch* composite state.</p></li><li><p>In the context menu, select _Refactor → Extract Subdiagram_.</p></li><li><p>Hover over the subdiagram decorator in the lower-right corner of the *LightSwitch* state.</p></li><li><p>Click on the subdiagram decorator.</p></li></ol> | No errors occur.<p>Subdiagram extraction leads to a normal-looking *LightSwitch* state, but with a subdiagram decorator in the lower left of state's box.</p><p>Hovering over that decorator shows a preview image of the subdiagram.</p><p>Clicking the decorator opens the subdiagram in a new editor tab.</p> | %{color:red}open% |
  6. | 12.2.1 | Undo & redo extracting subdiagram | <ol><li><p>Undo extraction by <code>[Ctrl+Z]</code>.</p></li><li><p>Redo extraction by <code>[Ctrl+Y]</code>.</p></li></ol> | The subdiagram extraction is reverted by <code>[Ctrl+Z]</code> and properly applied again by <code>[Ctrl+Y]</code>.| %{color:red}open% |
  7. | 12.2.2 | Copy state with subdiagram | <ol><li><p>Select the subdiagram-containing composite state *LightSwitch*.</p></li><li><p>Copy it to the clipboard using <code>[Ctrl+C]</code> resp. <code>[Cmd+C]</code> (Mac).</p></li><li><p>Select the main region.</p></li><li><p>Paste the copied state using <code>[Ctrl+V]</code> resp. <code>[Cmd+V]</code> (Mac).</p></li><li><p>Hover over the subdiagram decorator in the lower-right corner of the *Copy_1_LightSwitch* state.</p></li><li><p>Click on the subdiagram decorator.</p></li></ol> | <p>The copied state's name is *Copy_1_LightSwitch*.</p><p>Hovering over the decorator of the copied state shows a preview image of the subdiagram.</p><p>Clicking on the decorator of the copied state opens the subdiagram in a new editor tab.</p> | %{color:red}open% |
  8. | 12.2.3 | Delete copy | <ol><li><p>Delete the previously created state *Copy_1_LightSwitch*.</p></li><li><p>Save the statechart.</p></li></ol> | No errors occured. | %{color:red}open% |
  9. | 12.2.4 | Simulate | <ol><li><p>Run the simulation.</p></li></ol> | The behavior of the refactored model is equivalent to its behavior before refactoring. The *LightSwitch* state is highlighted. Transitions between *LightOff* and *LightOn* can be observed in the subdiagram editor tab mentioned in T12.2. | %{color:red}open% |
  10. | 12.3 | Inline subdiagram | <ol><li><p>Right-click on the edge or on the title area of the *LightSwitch* composite state.</p></li><li><p>In the context menu, select _Refactor → Inline Subdiagram_.</p></li></ol> | Same as in T12.1. | %{color:red}open% |
  11. | 12.3.1 | Simulate | <ol><li><p>Save the statechart.</p></li><li><p>Run the simulation.</p></li></ol> | The behavior of the refactored model is equivalent to its behavior before refactoring. | %{color:red}open% |
  12. | 12.4 | Prepare statechart | <ol><li><p>Delete the transition from *LightOn* to *LightOff*.</p></li><li><p>Delete the local reactions of both states *LightOn* and *LightOff*.</p></li><li><p>Create a second transition from *LightOff* to *LightOn*.</p></li><li><p>Enter "@A.keypress / light = true@" as reaction for _both_ transitions from *LightOff* to *LightOn*.</p></li></ol> | No error occurred. | %{color:red}open% |
  13. | 12.5 | Fold incoming actions | <ol><li><p>Right-click on the edge or on the title area of the *LightOn* state.</p></li><li><p>Select _Refactoring → Fold Incoming Actions_.</p></li></ol> | <ul><li><p>The reactions of both transitions from *LightOff* to *LightOn* are "@A.keypress@".</p></li><li><p>State *LightOn* has a local reaction of "@entry / light = true@".</p></li></ul> | %{color:red}open% |
  14. | 12.6 | Unfold entry actions | <ol><li><p>Right-click on the edge or on the title area of the *LightOn* state.</p></li><li><p>Select _Refactoring → Unfold Entry Actions_.</p></li></ol> | <ul><li><p>The reactions of both transitions from *LightOff* to *LightOn* are "@A.keypress / light = true@".</p></li><li><p>State *LightOn* has no local reaction.</p></li></ul> | %{color:red}open% |
  15. | 12.7 | Fold outgoing actions | <ol><li><p>Right-click on the edge or on the title area of the *LightOff* state.</p></li><li><p>Select _Refactoring → Fold Outgoing Actions_.</p></li></ol> | <ul><li><p>The reactions of both transitions from *LightOff* to *LightOn* are "@A.keypress@".</p></li><li><p>State *LightOff* has a local reaction of "@exit / light = true@".</p></li></ul> | %{color:red}open% |
  16. | 12.8 | Unfold exit actions | <ol><li><p>Right-click on the edge or on the title area of the *LightOff* state.</p></li><li><p>Select _Refactoring → Unfold Exit Actions_.</p></li></ol> | <ul><li><p>The reactions of both transitions from *LightOff* to *LightOn* are "@A.keypress / light = true@".</p></li><li><p>State *LightOff* has no local reaction.</p></li></ul> | %{color:red}open% |
  17. | 12.9 | Renaming | <ol><li><p>Double-click into the statechart's definition section.</p></li><li><p>Right-click on the name of the _light_ variable declaration.</p></li><li><p>In the context menu, select _Refactoring → Rename…_</p></li><li><p>In the dialog box, enter "@lamp@" as the variable's new name.</p></li><li><p>Click on _OK_.</p></li></ol> | All occurrences of the variable name _light_ are replaced by _lamp_. | %{color:red}open% |
  18. | 12.10 | Disabled menu item | <ol><li><p>In one of the two transactions from *LightOff* to *LightOn*, change the reaction to "@A.keypress / lamp = false@". The reaction of the other transition remains at "@A.keypress / lamp = true@".</p></li><li><p>Right-click on the edge or on the title area of the *LightOn* state.</p></li></ol> | In the submenu of the context menu's _Refactor_ entry, the _Fold Incoming Action_ entry is disabled. | %{color:red}open% |
  19. | 12.11 | Disabled menu item | <ol><li><p>Right-click on the edge or on the title area of the *LightOff* state.</p></li></ol> | In the submenu of the context menu's _Refactor_ entry, the _Fold Outgoing Action_ entry is disabled. | %{color:red}open% |
  20. | 12.12 | Toggle alignment | <ol><li><p>Create a new statechart model.</p></li><li><p>Delete the *StateA* state that has been created.</p></li><li><p>Add an orthogonal state (see the palette on the right).</p></li><li><p>Ignore any errors.</p></li><li><p>Right-click on the orthogonal state.</p></li><li><p>In the context menu, select _Toggle Subregion Alignment_.</p></li><li><p>Repeat the last action.</p></li></ol> | <ul><li><p>An orthogonal state without a name is created.</p></li><li><p>The state's subregions _r1_ and _r2_ are horizontally arranged, i.e. _r1_ is left from _r2_.</p></li><li><p>After toggling the subregion alignment for the first time, the subregions are vertically arranged, i.e. _r1_ is above _r2_.</p></li><li><p>After toggling the subregion alignment for the second time, the subregions are horizontally arranged again, i.e. _r1_ is left from _r2_.</p></li></ul> | %{color:red}open% |