11.10.2013 Views

(4 slides per page) - Updated

(4 slides per page) - Updated

(4 slides per page) - Updated

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Overview<br />

Phase 10<br />

Phase 11<br />

Introduction<br />

Procedure<br />

Example - TLC<br />

Example - SBC<br />

Phase 12<br />

Summary<br />

Overview<br />

Phase 10<br />

Phase 11<br />

Introduction<br />

Procedure<br />

Example - TLC<br />

Example - SBC<br />

Phase 12<br />

Summary<br />

Implementation of test cases for<br />

TrafficLightControl IV<br />

package tlc;<br />

import junit.framework.TestCase;<br />

public class TrafficLightBehaviorTest extends TestCase {<br />

...<br />

public void testTLC_Main_Road_Passing_2() {<br />

// ALL_WAIT_M<br />

// wait 3 seconds<br />

Thread.sleep(3000);<br />

// checks lights state using the testdriver<br />

assertTrue("main_red_yellow not set",<br />

lia.checkColor(true, true, true, false, false, false));<br />

// wait 1 second<br />

Thread.sleep(1000);<br />

// checks lights state (sec_green) using the testdriver<br />

assertTrue("main_green not set",<br />

lia.checkColor(false, true, false, false, true, false));<br />

// MAIN_PASSING<br />

// wait 21 seconds<br />

Thread.sleep(21000);<br />

// sends directly the srr signal to the provided interfaces<br />

tlb.srr()<br />

Validation: run tests<br />

Output of JUnit test environment:<br />

Test eesult with one error:<br />

77 / 89<br />

Testsuite: tlc.TrafficLightBehaviorTest<br />

Tests run: 24, Failures: 1, Errors: 0, Time elapsed: 3,345 sec<br />

Testcase: testInit2(tlc.TrafficLightBehaviorTest): FAILED<br />

main_red not set<br />

junit.framework.AssertionFailedError: main_red not set<br />

at tlc.TrafficLightBehaviorTest.testInit(TrafficLightBehaviorTest.java:103)<br />

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:<br />

Test tlc.TrafficLightBehaviorTest FAILED<br />

Test result with no errors:<br />

Testsuite: tlc.TrafficLightBehaviorTest<br />

Tests run: 24, Failures: 0, Errors: 0, Time elapsed: 103,345 sec<br />

79 / 89<br />

Overview<br />

Phase 10<br />

Phase 11<br />

Introduction<br />

Procedure<br />

Example - TLC<br />

Example - SBC<br />

Phase 12<br />

Summary<br />

Overview<br />

Phase 10<br />

Phase 11<br />

Introduction<br />

Procedure<br />

Example - TLC<br />

Example - SBC<br />

Phase 12<br />

Summary<br />

Implementation of test cases for<br />

TrafficLightControl V<br />

}<br />

}<br />

...<br />

// checks result using the testdriver<br />

assertTrue("main_yellow not set",<br />

lia.checkColor(false, true, true, false, false, false));<br />

// MAIN_PASSING_WILL_END<br />

// wait 1 second<br />

Thread.sleep(1000);<br />

// checks lights state using the testdriver<br />

assertTrue("main_red not set",<br />

lia.checkColor(true, true, false, false, false, false));<br />

// ALL_WAIT_S<br />

Example 2: sun blind control<br />

78 / 89<br />

80 / 89

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

Saved successfully!

Ooh no, something went wrong!