Debugging the External Module
❘
321
dEvEloPINg TEST PRoCEdURES FoR ExTERNAl modUlES
Many developers are beginning to realize the benefits of extensive application testing. There are
entire product categories devoted to the testing process now because testing is so important. Most, if
not all, developer tools now include some idea of application testing with them. In short, you should
have all the testing tools you need to test the static portion of your IronPython application.
Unfortunately, the testing tools might not work particularly well with the dynamic portion of the
application. Creating a test that goes from the static portion of the application to the dynamic por-
tion of the application is hard. (Chapter 18 shows that the opposite isn’t true — IronPython makes
an excellent tool for testing your static application.) Consequently, you need to include a test harness
with your dynamic code and perform thorough testing of the dynamic code before you use it with
the static application. (When you think about a test harness, think about a horse, your application
that has a harness added externally for testing purposes. You add the harness for testing and remove
it for production work without modifying the application.) Listing 15-1 shows an example of how
you might perform this task.
The test harness you create has to test everything, which is a daunting task to say the least. In addi-
tion, you need to expend extra effort to make the test harness error free — nothing would be worse
than to chase an error through your code, only to find out that the error is in the test harness. At a
minimum, your test harness should perform the following checks on your dynamic code:
➤
Outputs with good inputs
➤
Outputs with erroneous inputs
➤
➤
Exception handling within methods
➤
➤
Property value handling
➤
➤
Exceptions that occur on public members that would normally be private
➤
➤
Of course, you want to check every method and property of every class within the dynamic code.
To ensure you actually test everything, make sure you create a checklist to use to verify your test
harness. Because IronPython isn’t compiled, you’ll find that you must manually perform some
checks to ensure the code works precisely as planned, but use as much automation as possible.
Do'stlaringiz bilan baham: