# Automatic Test Data Generation Using the Activity Diagram and Search-Based Technique
## 1 Introduction  
Test case design is an important activity that consumes a large share of the budget and effort required for software testing. In particular, generating test data for executable test cases is a major challenge [1]. Accordingly, building a system to generate test data that maximizes fault detection effectiveness and minimizes the cost and effort is essential. The use of software models to automate the test generation process and reduce the testing cost and effort has been an active area of research for a long time [2; 3; 4]. Interest in model-based test automation has expanded along with the acceptance of Unified Modeling Language (UML) diagrams as the de facto standard for modeling software systems. Recent advances in model-based testing (MBT) have increased the feasibility and effectiveness of using MBT to automate or semiautomate the entire test generation process [2; 3]. In automated MBT, a model representing the expected behavior of the system under test (SUT) is developed and automatically analyzed to identify a set of test cases [5]. More recently, MBT practitioners have focused on using behavioral models of the SUT as a test basis to automate the test generation process [6]. Among the behavioral models, the activity diagram (AD), which has a rich symbolic vocabulary, is considered one of the most comprehensive and outstanding design artifacts for modeling all the intended behaviors of the SUT [7; 8]. Existing studies focused mainly on analyzing control flow among activities in an AD from the high-level business process (HLBP) to detect various control flow errors (e.g., loops, concurrency, and synchronization) [9; 10; 11; 7; 12; 13]. Generating abstract test cases to examine the control flow among design elements such as the AD on its own is inadequate to test the complete behavior of systems. Most software systems deliver functionality in terms of data; consequently, errors can easily occur if the flow of data is inappropriately modeled, defined, and used. Data flow testing was initially introduced to supplement control flow testing by incorporating the data flow information, referred to as definition-use (def-use) pair [14; 15]. Since then, a number of studies have been conducted, from a different perspective with different strategies, for the identification of def-use pairs information and evaluation of its effectiveness [16; 17]. The underlying idea behind data flow testing (DFT) is to detect inappropriate use of data or bad use of calculations. This idea is well-suited to the AD-based approach because ADs represent the sequences of actions that embody lower-level steps in the overall activity and are central to the data flow aspect of activities [18]. With growing software complexity and rapid change in business demands, smart automation of the test design process has become inevitable. The literature shows that automatic test generation using search-based metaheuristic algorithms to provide an appropriate set of test data for a specified coverage criterion has a high-cost efficiency and can reduce the human effort required compared with manual techniques [19]. The search-based testing technique using metaheuristic optimization algorithms, such as genetic algorithm (GA), has been widely studied and practiced, mostly in structural testing, to speed up the test design process [19; 20; 21; 22]. Speeding up the test design process to reduce the testing cost and effort is good, but unfortunately, the increase in test automation speed has come at the cost of very low quality. With the motivation to fully automate the test data generation process while adding more precision, our objective in this paper is to use the ADs of the SUT for test data generation by using a GA. For this purpose, we present an algorithm for the automatic identification of data flow information and a fitness function to cover the maximum number of def-use pairs. We call the approach AutoTDGen, and we implement it in a simple prototype tool.