Exercise 17 ( Chapter 23 )


Exercise 17 (Chapter 23)

Q1:

Indicate the changes required to LoginStoryTest (warning: this is a trick question):

 public class LoginStoryTest {    public void testLogin() {       assertTrue( login("bob","bobspassword") );       assertTrue( login("BOB","bobspassword") );       assertFalse(login("bob",""));       assertFalse(login("bob","BOBSPASSWORD") );    } } 
A1:

No changes are required to LoginStoryTest or any other executable test.

Q2:

Indicate the changes required to the setInterface method of XTrackTest:

 public void setTestInterface(String interfaceType){    if (interfaceType.equals("direct"))       testInf = new TrackDirectInterface();    else if (interfaceType.equals("webart"))       testInf = new TrackWebARTInterface();    else       fail("Undefined interface " +        interfaceType); } 
A1:

You need to test for guitar and create the appropriate interface:

 public void setTestInterface(String interfaceType){              if (interfaceType.equals("direct"))             testInf = new TrackDirectInterface();             else if (interfaceType.equals("webart"))                testInf = new TrackWebARTInterface();         else if (interfaceType.equals("guitar"))            testInf = new TrackGUITARInterface();             else                fail("Undefined interface " +                 interfaceType);    } 
Q3:

Are other changes required to XTrackTest or any other existing class?

A1:

No other changes are required to any existing class.



Testing Extreme Programming
Testing Extreme Programming
ISBN: 0321113551
EAN: 2147483647
Year: 2005
Pages: 238

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net