11.10.2013 Views

(4 slides per page) - Updated

(4 slides per page) - Updated

(4 slides per page) - Updated

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Overview<br />

Phase 10<br />

Introduction<br />

Notations<br />

Java<br />

Implementation<br />

of modules<br />

Module Tests<br />

Procedure<br />

Example - TLC<br />

Example - SBC<br />

Phase 11<br />

Phase 12<br />

Summary<br />

Overview<br />

Phase 10<br />

Introduction<br />

Notations<br />

Java<br />

Implementation<br />

of modules<br />

Module Tests<br />

Procedure<br />

Example - TLC<br />

Example - SBC<br />

Phase 11<br />

Phase 12<br />

Summary<br />

Test environment for the application component<br />

:TestAppTrafficLightsControl<br />

:TestCases<br />

Application<br />

srr_if’<br />

lights_state_if<br />

: TrafficLightBehavior<br />

: LightsApp<br />

TestDriver<br />

Test cases according to Phase 8.<br />

bl_if’<br />

er_if’<br />

Implementation of LightsTestDriver for<br />

lights state if<br />

timeout<br />

class LightsAppTestDriver implements lights_state_if {<br />

int color = 0;<br />

public final static int M_R = 1;<br />

public final static int S_R = 2;<br />

public final static int M_RY = 3;<br />

[...]<br />

public final static int ALL_OFF = 9;<br />

}<br />

public void main_red(){ color = M_R; }<br />

public void sec_red(){color = S_R; }<br />

public void main_yellow(){color = M_Y; }<br />

[...]<br />

public void all_off(){color = ALL_OFF;}<br />

public boolean checkColor(int colorNr) {<br />

boolean ret = (colorNr == color);<br />

color = 0;<br />

return ret;<br />

}<br />

: Timer<br />

TestDriver<br />

set_timeout<br />

53 / 89<br />

55 / 89<br />

Overview<br />

Phase 10<br />

Introduction<br />

Notations<br />

Java<br />

Implementation<br />

of modules<br />

Module Tests<br />

Procedure<br />

Example - TLC<br />

Example - SBC<br />

Phase 11<br />

Phase 12<br />

Summary<br />

Overview<br />

Phase 10<br />

Introduction<br />

Notations<br />

Java<br />

Implementation<br />

of modules<br />

Module Tests<br />

Procedure<br />

Example - TLC<br />

Example - SBC<br />

Phase 11<br />

Phase 12<br />

Summary<br />

Implementation of test driver for set timeout<br />

package tlc;<br />

class TimerTestDriver implements set_timeout {<br />

int sec = -1;<br />

public void SetTimeOut(int seconds) {<br />

sec = seconds;<br />

}<br />

public boolean checkSetTimeOut(int second) {<br />

boolean ret = (sec == second); sec = -1;<br />

return ret;<br />

}<br />

}<br />

Reset of sec to enable two consecutive checks with same value.<br />

Implementation of test cases for<br />

TrafficLightBehavior I<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

package tlc;<br />

import junit.framework.TestCase;<br />

public class TrafficLightBehaviorTest extends TestCase {<br />

TrafficLightBehavior tlb;<br />

LightsAppTestDriver lia;<br />

TimerTestDriver tot;<br />

public void testInitialization() {<br />

// Initialize the test environment and the SUT<br />

(System unter test).<br />

54 / 89<br />

56 / 89

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!