Software engineers primarily work on abstractions of physical representations in virtual systems
which contrast the software engineering discipline from established fields such as civil or
electronic engineering. Software solutions are normally developed to address a business need
and extended overtime by many engineers before being decommissioned.
Unit-Test-Driven-development (UTDD) is a technique utilised for developing code level tests for
validating and verifying functionality before writing production code (Beck, 2003). UTDD life
cycle consists of writing a series of tests, executing them, which fails then writing functional
code to satisfy the test. UTDD is more of a mindset than mechanics of writing unit tests.
Software development methods such as Extreme programming embrace UTDD to “catch
defects early” (Beck, 2004). Agile methodologies prioritise working software and encourage
close collaboration with stakeholders to respond to change (Manifesto, 2001). Although Extreme
programming is a variant of Agile, the emphasis of agile is customer satisfaction rather than
creating high quality code. Linear methodologies such as Waterfall, does not explicitly highlight
UTDD but finding out bugs early can only lead to better quality software.
Software reliability and quality are imperative for successful software solutions and it may be
achieved by ensuring each building block meets high assurance. In the lifecycle of a software
solution, software maintenance takes centre stage and UTDD offers a means of reducing
workload during this phase (Fang. 2023). Engineers are able to update the code confidently
knowing there are unit tests to ensure verification of other building blocks. When unit tests are
coupled with continuous integration, then immediate feedback is received if any test cases fail,
helping to detect defects early (Duvall, 2007).
Understanding and benefits of test-driven development among engineers are still basic. This
may be due to rapid delivery, changing requirements and shorter iteration cycles of agile
methodologies where software functionality is rated higher than software quality and
maintainability (Fang. 2023). As a result, test-driven development is not adopted, or tests are
written as an afterthought defeating the benefits of UTDD. Scope of unit tests in particular ends
at system boundaries such as a database. Assumptions may need to be made about these
external systems which may not always be accurate (e.g. incorrect data types). Functionality of
the overall system may still be inaccurate if wrong assumptions were made. UTDD cannot
detect incorrect or invalid business requirements as tests are manifestations of these
requirements in code. UTDD is a great initial step of software design and development and
should be supported by testing types such as integration, performance or security testing to
achieve the best outcome for customers.
My experience with UTDD is mixed and industry dependent. For example, long lived software
solutions such a software in medical devices tend to utilise UTDD, whereas ecommerce
systems where requirements tend to change drastically, software functionality take precedence.
As (Fang. 2023) mentioned, the understanding of UTDD among engineers is traditional and has
led to test-driven development being coined as “writing tests”. Metric driven engineering (i.e.
100% test coverage) adversely impacts UTDD because engineers write low quality tests to
“cover” the code rather than testing the actual business logic. There is empirical evidence to
support UTDD as a tool to improve software, and accepting code as intellectual capital rather
than commodity that can be written by Artificial Intelligence (AI), is how UTDD can take the
place it deserves.
References:
Beck, K, Test Driven Development: By Example. Addison-Wesley
Professional, 2003.
Beck, K. and Andres, C. (2004) Extreme programming explained : embrace change. 2nd ed.
Boston, MA: Addison-Wesley.
Manifesto for Agile Software Development (2001) . Available at: https://agilemanifesto.org/
(Accessed: 10 August 2024).
Duvall, P.M., Glover, A. and Matyas, S. (2007) Continuous integration : improving software
quality and reducing risk. 1st edition. Place of publication not identified: Addison Wesley.
Fang, Y. et al. (2023) ‘Effective computer software unit testing: thinking about unit test-driven
development (UTDD) mode’, in. SPIE, pp. 1297030-1297030–6. Available at:
https://doi.org/10.1117/12.3012428.