Unit tests as API usage examples
Authors:
- 1 September 2010
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- No. 10636773,p. 1-10
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
This publication has 19 references indexed in Scilit:
- What Makes APIs Hard to Learn? Answers from DevelopersIEEE Software, 2009
- The end-to-end use of source code examples: An exploratory study2009
- Characterizing Example Embedding as a software activity2009
- JExample: Exploiting Dependencies between Tests to Improve Defect Localization2008
- Usability Implications of Requiring Parameters in Objects' Constructors2007
- Composing Tests from Examples.The Journal of Object Technology, 2007
- How to design a good API and why it matters2006
- A survey of unit testing practicesIEEE Software, 2006
- How effective developers investigate source code: an exploratory studyIEEE Transactions on Software Engineering, 2004
- The Impact of eXtreme Programming on Maintenance2003