Chapter 23. Running Executable Tests through Other Interfaces


Getting over these mountain passes isn't so hard if you've got good maps and the right equipment. In the last chapter, we showed you how to make the executable tests run by directly calling the code we want to test. This approach has several problems:

  • The system must be written in the same language as the tests.

  • You need to know how the code works to call it.

  • The tests bypass potentially large and important sections of the system.

The first of these problems can be solved by choosing a suitable language in which to write the tests or by using special interfaces to call from the test language to the system language, such as the Java Native Interface (JNI).

If you have good programming skills, you can deal with the second point by reading the system code and/or spending some time on a programming pair developing it. If that isn't practical, have the programmers who are intimately familiar with the code write the methods in the application test class (XTrackTest in our example from Chapter 22). This will be easy for them to do if you've already written the executable tests, because the executable tests completely specify how these methods (like login, createUserId, addTask, and so on) are to behave.

Once these methods are written, you can probably figure out how to make the necessary changes when you refactor the executable tests, as we described in Chapter 16. If you need help, ask a programmer to pair with you. In fact, once an acceptance test has passed, you may wish to treat the test like production code, making changes only as part of a pair.



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