Yakindu SCT Testcase 11 - Operations.textile 3.2 KB

123456789101112
  1. h1(#Test2). Yakindu SCT Testcase 11 - Operations
  2. |_. Nr |_. Testname |_. Test Instructions |_. Postconditions |_. Status|
  3. | 11.1 | Preparations | In the src folder, create a new Java source file Operations.java with following contents:<p>@import java.io.IOException;@</p><p>@public class Operations {@</p><p>@public long returnFive() {@</p><p>@return 5;@</p><p>@}@</p><p>@public long returnSum(long i, double d) {@</p><p>@return (long) (i + d);@</p><p>@}@</p><p>@public void throwUncheckedException() {@</p><p>@throw new RuntimeException("Runtime Exception in executed code");@</p><p>@}@</p><p>@public void throwCheckedException() throws IOException {@</p><p>@throw new IOException("IOException in executed code");@</p><p>@}@</p><p>@}@</p><br></br><p>Right click on Staircase.sct.</p><p>In the context menu, select *Run as... → Run Configurations*.</p><p>In the Staircase run configuration, enter Operations as operation class.</p><p>Click *Apply*.</p><p>Click *Close*.</p><br></br><p>Open Staircase.sct and add the following to the internal scope:</p><p>@operation returnFive():integer@</p><p>@operation returnSum(param1 : integer, param2 : real ):integer@</p><p>@operation throwUncheckedException(): void@</p><p>@operation throwCheckedException():void@</p><p>@operation unsupportedMethod():void@</p> | There are no error markers in the project. There are five warnings "Internal declaration is not used in statechart". | %{color:red}open% |
  4. | 11.2 | Calling a valid operation during statechat execution | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and change the expression to "@after returnFive() s@".</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | After 5 seconds the state transitions from LightOn to LightOff. | %{color:red}open% |
  5. | 11.3 | CheckedException during execution | Open Staircase.sct.<p>Edit state LightOn.</p><p>Change expression to "@entry / throwCheckedException()@".</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | A popup method informs the user that a IOException has occurred in the executed code and offers to relaunch or terminate the simulation. | %{color:red}open% |
  6. | 11.4 | UncheckedException during execution | Open Staircase.sct.<p>Edit state LightOn.</p><p>Change expression to "@entry / throwUncheckedException()@".</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | A popup method informs the user that a RuntimeException has occurred in the executed code and offers to relaunch or terminate the simulation. | %{color:red}open% |
  7. | 11.5 | Calling invalid operation | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and change the expression to "@after returnFive s@", i.e. without the brackets.</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | After 5 seconds the state transitions from LightOn to LightOff. | %{color:red}open% |
  8. | 11.6 | Calling another valid operation during statechat execution | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and change the expression to "@after returnSum(1, 4.1) s@".</p><p>Run simulation.</p><p>Click keypress to transition to state LightOn.</p> | After 5 seconds the state transitions from LightOn to LightOff. | %{color:red}open% |