1234567891011 |
- h1. YAKINDU Statechart Tools – Testcase 11 - Operations
- |_. Nr |_. Testname |_. Test Instructions |_. Postconditions |_. Status|
- | 11.1 | Preparations | <ol><li><p>In the _src_ folder of the _TestProject_ project, create a new Java class _Operations_ (source file _Operations.java_) with the following contents:</p><p>@import java.io.IOException;@</p><p>@public class Operations {@<p> @public long returnFive() {@<br/> @return 5;@<br/> @}@<p> @public long returnPlusFive(long i) {@<br/> @return i+returnFive();@<br/> @}@<p> @public long returnSum(long i, double d) {@<br/> @return (long) (i + d);@<br/> @}@<p> @public void throwUncheckedException() {@<br/> @throw new RuntimeException("Runtime Exception in executed code");@<br/> @}@<p> @public void throwCheckedException() throws IOException {@<br/> @throw new IOException("IOException in executed code");@<br/> @}@<br/>@}@</p></li><li><p>In the project explorer, right-click on _Staircase.sct_.</p></li><li><p>In the context menu, select _Run as… → Run Configurations_.</p></li><li><p>In the run configuration, enter _Operations_ as operation class.</p></li><li><p>Click _Apply_.</p></li><li><p>Click _Close_.</p></li><li><p>Open _Staircase.sct_ and add the following to the internal scope:</p><p> @operation returnFive():integer@<br/> @operation returnSum(param1 : integer, param2 : real ):integer@<br/> @operation returnPlusFive(param1 : integer) : integer@<br/> @operation throwUncheckedException(): void@<br/> @operation throwCheckedException():void@<br/> @operation unsupportedMethod():void@</p></li><li><p>Save the file.</p></li></ol> | There are no error markers in the project. There are six warnings "Internal declaration is not used in statechart". | %{color:red}open% |
- | 11.2 | Check operation proposals | <ol><li><p>Open _Staircase.sct_.</p></li><li><p>Edit the transition from *LightOn* to *LightOff* and add "<code> / </code>".</p></li><li><p>Press @[Ctrl+Space]@.</p></li><li><p>Insert the operations proposals, each one replacing the previous one (if applies).</p></li></ol> | <ol><li><p>Chosing @returnFive():integer@ inserts @returnFive@.</p></li><li><p>Chosing @returnPlusFive(param1:integer):integer@ inserts @returnPlusFive()@ *and* places the cursor between the parantheses.</p></li><li><p>Chosing @returnSum(param1 : integer, param2 : real ):integer@ inserts @returnSum()@ *and* places the cursor between the parantheses.</p></li></ol> | %{color:red}open% |
- | 11.3 | Calling a valid operation during statechart execution | <ol><li><p>Open _Staircase.sct_.</p></li><li><p>In the transition from *LightOn* to *LightOff*, change the reaction to "@after returnFive() s@".</p></li><li><p>Save the statechart.</p></li><li><p>Run the statechart simulation.</p></li><li><p>Click _keypress_ to transition to state *LightOn*.</p></li></ol> | After five seconds, the state machine transitions from *LightOn* to *LightOff*. | %{color:red}open% |
- | 11.4 | CheckedException during execution | <ol><li><p>Open _Staircase.sct_.</p></li><li><p>In state *LightOn*, change the reaction to "@entry / throwCheckedException()@".</p></li><li><p>Save the statechart.</p></li><li><p>Run the statechart simulation.</p></li><li><p>Click _keypress_ to transition to state *LightOn*.</p></li></ol> | A popup window notifies the user that an IOException has occurred in the executed code. It offers to relaunch or terminate the simulation. | %{color:red}open% |
- | 11.5 | UncheckedException during execution | <ol><li><p>Open _Staircase.sct_.</p></li><li><p>In state *LightOn*, change change the reaction to "@entry / throwUncheckedException()@".</p></li><li><p>Save the statechart.</p></li><li><p>Run the statechart simulation.</p></li><li><p>Click _keypress_ to transition to state *LightOn*.</p></li></ol> | A popup window notifies the user that a RuntimeException has occurred in the executed code. It offers to relaunch or terminate the simulation. | %{color:red}open% |
- | 11.6 | Calling a valid operation during statechart execution | <ol><li><p>Open _Staircase.sct_.</p></li><li><p>In the transition from *LightOn* to *LightOff*, change the reaction to "@after returnFive s@", i.e. the operation name _without_ brackets.</p></li><li><p>In state *LightOn*, change the reaction back to the original "@entry / light = true@".</p></li><li><p>Save the statechart.</p></li><li><p>Run the statechart simulation.</p></li><li><p>Click _keypress_ to transition to state *LightOn*.</p></li></ol> | After five seconds, the state machine transitions from *LightOn* to *LightOff*. | %{color:red}open% |
- | 11.7 | Calling another valid operation during statechart execution | <ol><li><p>Open _Staircase.sct_.</p></li><li><p>In the transition from *LightOn* to *LightOff*, change the reaction to "@after returnSum(1, 4.1) s@".</p></li><li><p>Save the statechart.</p></li><li><p>Run the statechart simulation.</p></li><li><p>Click _keypress_ to transition to state *LightOn*.</p></li></ol> | After five seconds, the state machine transitions from *LightOn* to *LightOff*. | %{color:red}open% |
|