Code Missed by Direct Calls


That leaves the third point, which is the most serious and difficult of the three to deal with. To illustrate why this is such a serious problem, consider the login method of XTrackTest from Chapter 22 and recall our explanation of how the login code works that we're calling in XTrack:

When a user attempts to log in, the system calls the session login method with the id and password the user typed in.

 public boolean login( String id, String psw) {         session = new XTrackSession;         return session.login(id,psw);    } 

From our explanation, it's clear that some code in XTrack somehow takes what the user typed in for the id and password and calls the login method on that user's session object.

Does our test exercise that code? No our method bypasses that code. It has its own version of that code. Possibly the code in our login method and the code in XTrack that does the same thing are similar. The point is, when we run this test, we're not executing that code. We can find defects in the login method of the session object, but we can't find defects in the XTrack code that calls it. It's easy for an XP team, especially one without an experienced tester, to fall into this trap.

What if the session login method works great but that code in XTrack that we're duplicating here has a defect that causes it to always convert the user's password to lowercase? Or what if that code calls the login on the wrong session object? Some users aren't going to be able to log in, and there's no way our test can find these defects.



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