The Unit Test: Facing Cicd – Are They Elusive Definitions?
Total Page:16
File Type:pdf, Size:1020Kb
THE UNIT TEST: FACING CICD – ARE THEY ELUSIVE DEFINITIONS? Journal of Information Technology Management ISSN #1042-1319 A Publication of the Association of Management THE UNIT TEST: FACING CICD – ARE THEY ELUSIVE DEFINITIONS? HADAS CHASIDIM SCE — SHAMOON COLLEGE OF ENGINEERING [email protected] DANI ALMOG SCE — SHAMOON COLLEGE OF ENGINEERING [email protected] DOV BENYOMIN SOHACHESKI SCE — SHAMOON COLLEGE OF ENGINEERING [email protected] MARK L. GILLENSON UNIVERSITY OF MEMPHIS [email protected] ROBIN POSTON UNIVERSITY OF MEMPHIS [email protected] SHLOMO MARK SCE — SHAMOON COLLEGE OF ENGINEERING [email protected] ABSTRACT The widely used term “unit test,” which is a quality procedure for testing modules of software code, has been used for decades. To enable unit testing, specialized infrastructures were designed to enable the isolation of unit tested code from its production implementation. Currently, hundreds of tools and add-ons exist for unit testing in almost every software development environment and language. Integration testing, on the other hand, which is a quality procedure for testing multiple modules of software code working together, demands a vastly different kind of infrastructure to enable the interaction of the code with other production implementation components. With the growing popularity of agile methods, the boundaries of unit and integration testing have become blurred with Continuous Integration (CI) and Continuous Deployment (CD) derived from market demand for continuous reply and reaction of the software to a rapidly changing world. CICD enhances the importance of unit testing. Following that, it is important to identify the effect of new agile software development life cycles (SDLC) on unit test activities – assuming it may affect software quality in general. In this paper, we analyze the evolving different definitions and usages of the term “unit test” and attempt to understand the implication of these definitions to the actual use of the term. Keywords: unit test, component test, unit under test Journal of Information Technology Management Volume XXIX, Number 2, 2018 40 THE UNIT TEST: FACING CICD – ARE THEY ELUSIVE DEFINITIONS? On the other hand, many people use the term “unit test” INTRODUCTION with different connotations and meanings referring to the test of a specific component or functionality. Motivation It is necessary to differentiate between the “unit Continuous Integration (CI) and Continuous under testing” and “unit test.” While unit testing is the Deployment (CD) [10] are new trends driven by market act of testing at the unit of software code, e.g., one demand. This trend is affecting the ability to provide an module, level, the term unit under test refers to the earlier and conscientious delivery of adaptation and various portions of software code that are being tested. changes to the software product. These new working The first formal definitions of “unit testing” supported by paradigms signify a different approach towards software the ANSI/IEEE Std 1008-1987, IEEE Standard for development life cycles (SDLC) and the need to Software Unit Testing reveal some flexibility concerning understand the impact of this change on software quality the meaning of the word “unit” in “unit testing,” see insert and testing procedures. The effect of the change may be below. This definition is not precise enough for today’s very significant at all dimensions of the organization and various approaches to SDLC, especially within the agile software development processes, with an examination of SDLC environments. For example, is a unit a single item its effect on unit testing being the first step. It is essential or a set of items? Moreover, the definition does not to ensure a common language among SDLC team provide us with a definite idea of the actual intention of members using the term "unit test" consistently. To model the unit definition. the CICD practices of different software industries [16], A set of one or more computer program modules the authors consider unit testing to be the basic procedure together with associated control data (for example, within the CICD approach. Following a review of the tables), usage procedures, and operating procedures that literature on CICD, research on CICD reports the satisfy the following conditions: consistent and meaningful use of unit test during the 1. All modules are from a single computer CICD process. Building on this work, this research program. explores the different definitions and usage of the term 2. At least one of the new or changed modules in "unit test" during the last ten years as reflected in the the set has not completed the unit test. academic literature. 3. The set of modules together with its associated The goal of this research study is to arrive at a data and procedures is the sole object of a better understanding of the term “unit test” and its testing process. applications. We explore the primary usages of the term Over the years, academics, open-source to see whether there are differences of opinion among participants, and the software industry have generated an leading academic researchers. To our knowledge, this is abundance of different definitions for unit tests [11]. one of the first papers that aims to better understand the While some definitions are products of necessity, others influence of current changes in software development reflect a given principle. The majority of definitions cite approaches and philosophies on testing efforts. This is principle buzzwords and concepts, attempting to remain thus an initial step in trying to arrive at a clearer accurate and authentic concerning the absolute definition understanding of the intention behind the value of unit of “unit.” Such as the case where unit tests cover only testing. functional requirements or when a unit is defined as First, we report the outcome of literature review writing many tests for one unit without actually formally research done on academic papers. The next section defining a unit. contains our definitions and suggestions to refine the The adoption of the use of xUnit tools in practice definition and use unit testing in today’s more agile is a rather straightforward process, and the administration SDLC processes. The last section concludes our findings of tests involving the use of these tools is also relatively and gives recommendations for our future research. easy. The main drawback is the misconception that such tests are categorized as unit tests. With the help of familiar testing tools, unit testing has become a Unit Testing in General chameleon that can almost imperceptibly camouflage Today, almost every programming language has itself and transform itself into other types of testing. As its individual unit testing framework (e.g., JUnit for Java, Andrew Hunter has aptly noted, “Unit tests have quickly NUnit for C#), which enables the use of small, become the proverbial hammer that makes everything automatically executable unit tests. Unit testing has look like a nail” [7]. become an accepted practice, often mandated by When codebases were still relatively small, and development processes (e.g., test-driven development). implementations were more transparent, the notion of a Journal of Information Technology Management Volume XXIX, Number 2, 2018 41 THE UNIT TEST: FACING CICD – ARE THEY ELUSIVE DEFINITIONS? unit was straightforward. Original software systems Instead of single regulatory outcomes from one unit, we delivered anywhere from a single service to a series of find ourselves imitating input from various units to services and behavior patterns. The behavior patterns conclude about a given unit. Developers find themselves were modest, and they focused on a specific goal. The uncovering the encapsulation of units and their original (still true to this the day) philosophy behind the dependencies to perform unit tests, a task that is Unix operating system (OS) is DOTADIW: “Do One tantamount to unit integration testing, a topic that is Thing and Do It Well” [13]. The entire OS was a scaffold, beyond the purview of this paper. using “very narrow, very tightly specified interfaces” [7]. Unix and Interlisp quickly gained popularity due to their Previous Surveys on Unit Tests separation of responsibilities through the use of pipes, In 2006, a unit testing practices survey [14] was filters, and interfaces [7]. performed based on focus group discussions in a software The unit can be complex in its capabilities, but it process improvement network (SPIN) and a questionnaire is intended to be solely focused on a unique output. This was employed to validate the results (shown in Table 1). characteristic transforms the unit into a black box; when it The purpose of the survey was to investigate what is provided with input, the unit will not deviate from its practitioners refer to when they talk about unit testing. established, predetermined goal. Since this survey has been conducted, more than Unit testing is the sort of testing that is usually 11 years ago, it seems logical to reexamine the use of its close to the heart of developers [18]. The primary reason terminology and practices. Programming languages, as is that, by definition, unit testing tests distinct, well- well as design implementations, have changed due to defined parts of the system in isolation from other parts. more complex software capabilities. A more recent survey Thus, they are comparatively easy to write and use. Many 2014 [5] focused on the possible test automation benefits build systems that have built-in support for unit tests, derived from the unit test: which can be leveraged without undue difficulty. With 1. What motivates developers to write unit tests? Maven [9], for example, there is a convention that The driving force behind unit testing are the describes how to write tests such that the build system can developers’ conviction and management find them, execute them, and finally prepare a report of requirements the outcome. Writing tests boils down to writing test 2.