Alessandro Amici - Test-driven code search and reuse coming to Python with pytest-nodev
We will present the test-driven reuse (TDR) development strategy, a
natural extension of test-driven development (TDD), and how to execute
it with [pytest-nodev] an Open Source test-
driven search engine for Python code.
When developing new functionalities developers spend significant
efforts searching for code to reuse, mainly via keyword-based
searches, e.g. on StackOverflow and Google. Keyword-based search is
effective in finding code that is explicitly designed and documented
to be reused, e.g. libraries and frameworks, but typically fails to
identify reusable functions and classes in the large corpus of
auxiliary code of software projects.
TDR aims to address the limits of keyword-based search with test-
driven code search that focuses instead on code behaviour and
semantics. Developing a new feature in TDR starts with the developer
writing the tests that will validate candidate implementations of the
desired functionality. Before writing any functional code the tests
are run against all functions and classes of available projects. Any
code passing the tests is presented to the developer as a candidate
implementation for the target feature.
[Pytest-nodev] and other nodev tools that help implement TDR for Python are newer than the JAVA counterparts, in spite of that we will present several applications of the technique to more and more complex examples. |