by Daniel Böhnke for EuroPython 2012
Software testing is essential to ensure quality standards and guide effective development. Nevertheless, for highly specialized codes conventional testing methods are unsatisfying, as quality goals differ.
The talk focuses on two testing methods for engineering applications. These will be applied to a conceptual aircraft design code written in Python. Sensitivity analysis is introduced as a method for unit testing. Additionally, system tests are realized by using a historical aircraft database. Tests are implemented in VAMPzero
For example, an engineer is absolutely fine with a number of passengers equal to 140.7 as long as it results in the desired payload mass. Hence, the requirements for a unit test are: a) if there are 140.7 passengers aboard the aircraft there must be a positive float value for the payload mass and much more important b) if the number of passengers is increased the payload increases as well! While a) can be tested using conventional unit tests, b) can be tested using sensitivity analysis. The results of the sensitivity analysis can be compared to expert knowledge. This knowledge is derived from interviews and coded in simple expression statements. The talk will introduce complex step derivative approximation as means for sensitivity analysis and outlines some first test results.
When it comes to system testing, conceptual aircraft design codes need to design aircraft concepts. It is therefore obvious that a database of aircraft characteristics forms suitable test cases. While doing system tests of the code, aircraft characteristics from the database serve as input for the code and the calculation results are compared again to an aircraft performance database. As the code operates on a low level of fidelity one can only tell how far it is off. Nevertheless, good assumptions on the quality of the code and especially on the impact of newly implemented design methods can be made.
Any new application must be manual tested before its testing can be automated. Manual testing requires more effort but is necessary before deciding on automation.