123456789101112 |
- h1(#Test2). Yakindu SCT Testcase 11 - Operations
- |_. Nr |_. Testname |_. Test Instructions |_. Postconditions |_. Status|
- | 11.1 | Preparations | In the src folder, create a new Java source file Operations.java with following contents:<p> @import java.io.IOException;@<br> @public class Operations {@<p>  @public long returnFive() {@<br>  @return 5;@<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>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@<br> @operation returnSum(param1 : integer, param2 : real ):integer@<br> @operation throwUncheckedException(): void@<br> @operation throwCheckedException():void@<br> @operation unsupportedMethod():void@ | There are no error markers in the project. There are five warnings "Internal declaration is not used in statechart". | %{color:red}open% |
- | 11.2 | Calling a valid operation during statechat execution | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and change the expression to <br>"@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% |
- | 11.3 | CheckedException during execution | Open Staircase.sct.<p>Edit state LightOn.</p><p>Change expression to <br>"@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% |
- | 11.4 | UncheckedException during execution | Open Staircase.sct.<p>Edit state LightOn.</p><p>Change expression to <br>"@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% |
- | 11.5 | Calling invalid operation | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and change the expression to <br>"@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% |
- | 11.6 | Calling another valid operation during statechat execution | Open Staircase.sct.<p>Edit transition from LightOn to LightOff and change the expression to <br>"@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% |
|