When to Automate Software Testing? Decision Support Based on ...

4 downloads 76 Views 1006KB Size Report
May 28, 2014 - Keywords. Software testing, automated testing, manual testing, decision support, process simulation, system dynamics. 1. INTRODUCTION.
When to Automate Software Testing? Decision Support Based on System Dynamics: An Industrial Case Study Zahra Sahaf1, Vahid Garousi1, 2, Dietmar Pfahl1, 3, Rob Irving4, Yasaman Amannejad1 1: Department of Electrical and Computer Engineering, University of Calgary Calgary, Canada

{zahras, vgarousi, dpfahl}@ucalgary.ca

2: Department of Software Engineering, Atilim University Ankara, Turkey

3: Institute of Computer Science, University of Tartu Tartu, Estonia

[email protected]

4: Pason Systems Corporation Calgary, Canada

[email protected]

ABSTRACT

Keywords

Software test processes are complex and costly. To reduce testing effort without compromising effectiveness and product quality, automation of test activities has been adopted as a popular approach in software industry. However, since test automation usually requires substantial upfront investments, automation is not always more cost-effective than manual testing. To support decision-makers in finding the optimal degree of test automation in a given project, we propose in this paper a simulation model using the System Dynamics (SD) modeling technique. With the help of the simulation model, we can evaluate the performance of test processes with varying degrees of automation of test activities and help testers choose the most optimal cases. As the case study, we describe how we used our simulation model in the context of an Action Research (AR) study conducted in collaboration with a software company in Calgary, Canada. The goal of the study was to investigate how the simulation model can help decision-makers decide whether and to what degree the company should automate their test processes. As a first step, we compared the performances of the current fully manual testing with several cases of partly automated testing as anticipated for implementation in the partner company. The development of the simulation model as well as the analysis of simulation results helped the partner company to get a deeper understanding of the strengths and weaknesses of their current test process and supported decision-makers in the cost effective planning of improvements of selected test activities.

Software testing, automated testing, manual testing, decision support, process simulation, system dynamics.

1. INTRODUCTION As of year 2002, software quality issues in the form of defects (bugs) cost the United States economy an estimated $59.5 billion annually and it is estimated that improved testing practices could reduce this cost by $22.5 billion [1]. The steps of a software test process can be conducted manually or automated. For example, in manual testing, the tester may assume the role of an end-user executing the software manually to identify unexpected behavior and defects. In automated testing, the tester may write test code scripts (e.g., using the JUnit framework) which are executed automatically to check the software under test (SUT) [2]. Deciding when to automate testing is a frequentlyasked and challenging question for testers in industry [3]. As test automation requires an initial investment of effort, testers are interested in finding the answer to this question. More specifically, testers are interested in understanding the return on investment (ROI) of test automation, i.e., when a positive ROI is reached and what total ROI can be achieved. Several studies have been carried out to investigate the ROI of test automation [4-9]. However, these studies are limited as they either focus exclusively on the process step of test execution, or calculate the ROI exclusively based on variables which must be converted to one unit (typically ‘time’, ‘effort’ or ‘cost’) and thus ignore influencing factors that cannot be transformed into a unique unit (e.g., variables representing ‘size’, ‘skill’, or ‘quality’), or merely present theoretical models without empirical evaluation. The objective of our study is to assess the ROI of test automation with a holistic approach, i.e., incorporating essential aspects of software testing processes that – according to the existing literature – influence the performance of software testing processes. Furthermore, our holistic view on the problem aims at evaluating both manual and (at least partly) automated testing, considering all steps typically involved in software testing, from test-case design, to test-case scripting, to test execution, test evaluation and reporting of test results.

Categories and Subject Descriptors D.2.5 [Software Engineering]: Testing and Debugging.D.2.9 [Software Engineering]: Management – Software quality assurance.K.6.3.3 [Management of Computing and Information Systems]: Software Management – Software development, Software process.

General Terms Management, Measurement, Experimentation, Verification.

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

We develop in this work a System Dynamics (SD) process simulation model that serves as a tool to investigate various configurations of test processes for the purpose of decision support on when to automate software testing. SD is a modeling technique to model, study, and manage complex systems [10]. It

ICSSP’14, May 26–28, 2014, Nanjing, China Copyright 2014 ACM 978-1-4503-2754-1/14/05...$15.00 http://dx.doi.org/10.1145/2600821.2600832

149

Indirect (or ‘higher-order’) factors, side-effects, and feedbackloops are usually excluded from the analysis.

aims at identifying the key variables representing the system states, and defines their linkages to establish a representation of the system structure. For our study, we developed a generic SD model representing the key steps of software testing and then customized and calibrated this model to the test processes of Pason Systems Corporation, the industrial partner in this study. By instantiating the SD model for the cases of manual and automated testing, we could simulate each process option separately. Based on an in-depth analysis of the simulation results, we then compared the strengths and weaknesses of each process option and provided answers to the questions of when a positive ROI is reached and what total ROI is achieved. In addition, the simulation model helped us investigate whether proposed process changes have the potential to increase the ROI of test automation.

In addition to publications reporting the results of cost-benefit analyses of test automation, we found several literature reviews and surveys focusing on collecting evidence about benefits and limitations of manual and automated testing [11, 12]. For example, in a recent in-depth study combining a literature review and a survey, Rafi et al. [11] found that benefits of test automation mainly relate to better reusability and repeatability of tests as well as higher test coverage and lower test execution cost. The biggest impediment for test automation was the high initial investment into test automation setup, tool selection and training. The authors also indicate that benefits of test automation often had support from experiments and case studies, while statements about limitations and impediments of test automation often originate from experience reports. Furthermore, the authors noticed that in their survey and follow-up interviews, responses from students and faculty in academia did not always comply with responses received from engineers and managers in industry. With a stronger focus on the industry-perspective, Taipale et al. [12] explored the current state of automation in software test organizations by collecting and analyzing views and observations of managers, testers and developers in several organizations. The authors found that although test automation is viewed as beneficial, it is not utilized widely in the companies. According to Taipale et al., the main benefits of test automation are improved code quality, the possibility to execute more tests in less time and easy reuse of testware. The major disadvantages of test automation are related to the costs associated with developing test automation especially in dynamic environments. In addition, properties of tested products, attitudes of employees, resource limitations, and the types of customers influenced the level of test automation found in surveyed organizations.

In this paper, we present the following contributions to our industrial partner and the research community: 1.

2. 3.

A conceptual test process reference model comprising the typical steps of a comprehensive software test process, the relations between steps, and the key parameters influencing test process performance. (Section 3) Provision of a modular, customizable and scalable SD simulation model implementing the conceptual test process reference model. (Section 4) Demonstration that an SD-based simulation model can be successfully used as a cost-benefit analysis tool for comparing manual and (semi-)automated testing. (Section 5)

The rest of the paper is organized as follows. In Section 2, we discuss background and related work. In Section 3, we present the steps contained in a typical software test process and use it as a reference model for the SD modeling stage. In Section 4, we present the SD model representing the typical software test process. In Section 5, we present the industrial case study utilizing the approach, summarize and discuss the simulation result for different scenarios, i.e., manual versus automated testing. Finally, Section 6 presents conclusions and directions for future work.

While the results from the surveys and literature reviews are helpful to gain an understanding about the available empirical evidence and the opinions of researchers, engineers and managers on strengths and limitations of test automation, it does not provide guidance for companies on what to automate (and what not) in their specific context.

2. BACKGROUND AND RELATED WORK

2.2 Software Testing Simulation Methods

We present a brief overview of published literature related to our research topic, i.e., the investigation of costs and benefits of full or partial automation of software testing, and software testing simulation methods.

Beginning with the seminal work by Kellner and Hansen [13] and Abdel-Hamid and Madnick [14] in the late 1980s, software process simulation has become an active and growing area of research [15] and many companies have experimented with using process simulation models as a management and decision-support tool. However, only a small number of the published simulation models focus on the analysis/improvement of software test processes. For example, Collofello et al. [16] proposed using process simulation (using an SD model) to identify and analyze factors responsible for testing costs. Among other factors, the type of software to be developed and associated quality requirements as well as the degree of thoroughness of testing contributes to costs and benefits of testing. Rus et al. [17] developed a process simulator that aimed to investigate the impact of management and reliability engineering decisions on the reliability of software products. Raffo and Wakeland [18] developed a process simulator that was used to investigate costs and benefits of inspections, verification, and validation activities in NASA software development projects. Garousi et al. [19] presented an extensible and customizable SD process simulation model that can be used to assess trade-offs of different combinations of verification and validation activities, including inspections and various types of test levels, with regards to project performance parameters such as effort, duration, and product quality. None of the aforementioned

2.1 Cost-Benefit Analysis Methods The standard approach to compare manual with automated testing and analyzing the strengths and weaknesses of each option is costbenefit analysis. [5-7]. The limitations of this method include: (a) typically, in a cost-benefit analysis all cost and benefit factors are converted into a single unit of comparison, i.e., time, effort, or cost (using a monetary unit such as US dollar). This inevitably results in a predominant focus on immediate time, effort or cost saving benefits of the automated test activities. However, test automation may have other more indirect or long-term benefits such as improved maintenance, defect detection effectiveness, and reusability of product code and test code; (b) Moreover, the necessity of expressing all factors influencing cost or benefit in terms of a single unit might result in ignoring or overlooking important factors that cannot (easily) converted into the single unit of choice (e.g., skills of engineers, size and quality of artifacts, and familiarity with tools); (c) Finally, cost-benefit analysis methods are limited to considering only direct (or ‘first-order’) factors influencing the cost and/or benefit of a test activity.

150

publications investigated to what extent test automation influences the costs and benefits of testing.

changed by the modeled system itself.

During the past five years several process simulators were developed modeling Agile and lean software development processes (e.g., [20, 21]). This is related to our research, since most agile and lean processes suggest automation test activities (in particular unit testing). However, the published simulation models representing agile and lean development processes were neither designed (i.e., they lack structural detail about testing activities) nor used to investigate how the automation of one or several test activities influences the cost-benefit balance of software development projects.

Figure 1. Symbols of System Dynamics Model Typically, flows are calculated as mathematical functions of levels, (other) rates, auxiliary variables and constant variables. As the simulation advances in small time increments, it computes at each increment the changes in levels and flow rates. Thus, an SD process can be imagined as the approximation of a continuous, fluid-like process of a liquid accumulating into and flowing out of a container. In software development, for example, the defect generation rate may be treated as a flow rate and the current numbers of defects at any point in time could be treated as a level. When a flow originates from outside the scope of the system to be modeled, the flow’s origin is called a ‘source’ and represented by a cloud symbol. Similarly, when the destination of a flow is outside the scope of modeling, it is called a ‘sink’.

2.3 Background on System Dynamics System Dynamics (SD) was introduced by Forrester as a simulation modeling technique that applies the engineering principles of feedback and control to socio-technical systems [10]. In SD, a system is defined as a self-contained collection of elements that continually interact with each other. The two important aspects of SD models are structure and behavior. Structure is defined as the collection of components of a system, and their relationships. The structure of the system may also include parameters representing external influence on the system’s behavior. Behavior is defined as the way in which the elements (or variables) composing the modeled system vary over time.

There exist several professional SD modeling and simulation tools, e.g., Vensim, PowerSim, iThink and STELLA. In our case study, we used Vensim as it seems to be the SD tool with the most comprehensive set of analysis functionality.

SD models describe a system in terms of ‘levels’ representing the states of the system (refer to Fig. 1). Levels are accumulators (or stocks) of incoming and outgoing ‘flows’ of material. The flow ‘rates’ describe how much material can flow into or out of a level per time step. For internal calculations, SD models can have ‘auxiliary variables. Model parameters are represented by socalled ‘constant’ variables. Constant variables have fixed values that cannot change due to internal system behavior. Their values can only be changed by the model user and thus they are either used to represent external influence on the model system or to calibrate the model to empirically observed data which cannot be

Test-case Design

uses

Self knowledge

3. TEST PROCESS REFERENCE MODEL Based on standard textbooks on software testing and incorporating different views and classifications [22-24], we developed a test process reference model which is shown in the form of a UML activity diagram in Fig. 2. As per their nature, manual and automated testing includes different activities. By synthesizing the views and classifications found in the literature, we divide the testing process into the following activities:

Manual Test Execution

Exploratory testing

Activity/data providing benefit triggers

Test Scripting

Test suite

Manual Tester

Cost-incurring activity (effort)

Manual test script

Co-maintenance

triggers Need for Maintenance

triggers

Triggers (need for new test cases)

SUT Artifact

triggers

Maintenance

triggers

Fault

Test Evaluation Fault Localization

Developer changes

Fault detection effectiveness

triggers

Pass

uses Test-case Design

Test Developer (Automated Testing)

Test-code Refactoring, a.k.a. perfective maintenance

Co-maintenance, a.k.a. Test Repair tradeoff in cost changes

improves Test suite

Test Scripting

Test scripts

triggers

Fault detection effectiveness

Test Execution

Test Evaluation

Figure 2. Software testing reference process

151

Test Results

Failure

1. 2. 3. 4. 5. 6.

Note that the software testing reference model as presented in Fig. 2 does not distinguish between various test levels (e.g., unit testing versus system testing). This distinction is not needed since the model can simply be instantiated to the test level of interest.

Test-case design: Preparing test data and developing test procedures Test scripting: Documenting test cases in manual test scripts or test code for automated testing Test execution: Running test cases on the software under test (SUT) and recording the results Test evaluation: Evaluating results of testing (pass or fail), also known as test oracle or test verdict. Test co-maintenance: Repairing existing manual test cases and test scripts when the SUT is maintained or addition of new test cases. Test code refactoring (only for automated testing): Perfective maintenance of code that is needed for automated test script execution.

4. DEVELOPMENT OF SYSTEM DYNAMICS (SD) MODEL The activities defined for software testers in the software testing

reference process set the scope of our SD model which thus reflects the basic building blocks of a testing process. Similarly to what we mentioned at the end of the previous section about the possibility to instantiate the software testing reference model, the SD model described in this section could be instantiated accordingly. For the specific application at Pason, our case company (cf. Section 5), we focus mainly on system testing activities.

Fig. 2 also shows related activities performed by testers and developers in response to the test activities, i.e., fault localization and maintenance of the SUT. In each test activity, artifacts are produced. At first, in the test case design step, test cases are designed using either black- or white-box test approaches. The output of this step is a test suite, forming the input to the next step, test scripting. Test scripts, the output from the test scripting step, are the set of instructions that are performed on the SUT. When the test scripts are executed, test results are generated and – based on a test oracle – verdicts (pass or fail decisions) are reported to developers. Maintenance activities on test suites are needed for two reasons: (1) either new test cases and scripts have to be added due to the change in software requirements, or (2) it turns out that test cases and/scripts have to be corrected. In the case of automated testing, in addition to maintenance also test-code refactoring activities might be needed.

To make the SD model structurally uniform, independent from the decision whether a test activity is performed manually or automatically, we subsumed activity ‘test code refactoring’ under ‘test maintenance’. By parameterizing and initializing elements (i.e., testing activities) of the SD model differently for manual and automated testing, we can compare these two options, for example, by checking how many test cases can be executed in the same period of time, how much time can be devoted for each activity, how much time should be saved as a whole, or any other desired aspect in perspective of test manager. In order to represent the software testing reference process in our SD model, we had to identify levels (or: stocks) and flow rates (attached to the in- and out-flows of a level). This was done in a straight-forward manner. After subsuming the refactoring step under maintenance, and after sub-dividing the execution step into

Reusing

Scripts Cycle Checker

Initial Test Case rate

Planned Test Cases

Passing





Test Results

Test Suite Designing

Passing Tests

Executing

Scripting

Failing

Failing Tests



New Test Cases

Reporting Passed

Evaluating and Reporting Failed

Reports



Suggest Documents