Title :
Unit tests as API usage examples
Author :
Nasehi, Seyed Mehdi ; Maurer, Frank
Author_Institution :
Dept. of Comput. Sci., Univ. of Calgary, Calgary, AB, Canada
Abstract :
This study aims to find out if API unit tests can provide good usage examples, and if so, what prevents developers from finding and using those examples. The results of an experiment we performed with two groups of developers showed that unit tests can be very helpful, especially when the task is complicated and involves multiple classes and methods. Well-written tests proved to be a good source of examples, but finding the relevant examples using the standard tools might be very difficult. We propose to supplement the standard API documentation with relevant examples taken from the unit tests. To further improve the learnability of the API, presentation of the documentation and examples has to be tailored in a way that separates or hides advanced usage scenarios from the commonly used ones.
Keywords :
application program interfaces; program testing; API unit tests; API usage examples; advanced usage scenarios; application programming interface; standard API documentation; Barium; Noise measurement; API; Code Example; Documentation; Unit Test; Usability;
Conference_Titel :
Software Maintenance (ICSM), 2010 IEEE International Conference on
Conference_Location :
Timisoara
Print_ISBN :
978-1-4244-8630-4
Electronic_ISBN :
1063-6773
DOI :
10.1109/ICSM.2010.5609553