Skip to main content
zenodoopen

ATM: Black-box Test Case Minimization based on Test Code Similarity and Evolutionary Search – Replication Package

<p>This is the replication package associated with the paper &quot;<em>ATM: Black-box Test Case Minimization based on Test Code Similarity and Evolutionary Search</em>&quot; accepted at the&nbsp;45th IEEE/ACM International Conference on Software Engineering (ICSE 2023)&nbsp;&ndash; Technical Track. Cite this paper using the following:</p> <p><em>@inproceedings{pan2023atm,<br> &nbsp; title={ATM: Black-box Test Case Minimization based on Test Code Similarity and Evolutionary Search},<br> &nbsp; author={Pan, Rongqi and Ghaleb, Taher A. and Briand, Lionel},<br> &nbsp; booktitle={Proceedings of the 45th IEEE/ACM International Conference on Software Engineering},<br> &nbsp; year={2023},<br> &nbsp; pages={1--12}<br> }</em></p> <p><strong>Replication Package Contents:</strong><br> The replication package contains all the necessary data and code required to reproduce the results reported in the paper. We also provide the results for other minimization budgets, and detailed&nbsp;<em>FDR,</em>&nbsp;execution time, and statistical test results. In addition, we provide the data and code required to reproduce the results of baselines techniques: FAST-R and random minimization.</p> <p><strong>Data:</strong><br> We provide in the&nbsp;<em><strong>Data</strong></em>&nbsp;directory the data used in our experiments, which is based on 16 projects from&nbsp;<a href="https://github.com/rjust/defects4j">Defects4J</a>, whose characteristics can be found in&nbsp;<em><strong>Data/subject_projects.csv</strong></em><em>.</em></p> <p><strong>Code:</strong><br> We provide in the&nbsp;<em><strong>Code</strong></em>&nbsp;directory the code and scripts (Java, Python, and Bash) required to run the experiments and reproduce the results.</p> <p><strong>Results:</strong><br> We provide in the&nbsp;<em><strong>Results</strong></em>&nbsp;directory the results for each technique independently, and also a summary of all results together for comparison purposes. The source code for this step is in the&nbsp;<em><strong>Code/ATM/CodeToAST</strong></em>&nbsp;directory. The source code for this step is in the&nbsp;<em><strong>Code/ATM/Similarity</strong></em>&nbsp;directory.</p> <p><strong>_________________________________</strong></p> <p><strong>ATM - Code to AST transformation:</strong></p> <p><strong>Requirements:</strong><br> * Eclipse IDE (we used 2021-12)<br> * The libraries (the&nbsp;<em><strong>.jar</strong></em>&nbsp;files in the&nbsp;<em><strong>Code/ATM/CodeToAST/lib</strong></em>&nbsp;directory)</p> <p><strong>Input:</strong><br> All zipped data files should be unzipped before running each step.<br> * Data/test_suites/all_test_cases.zip &rarr; Data/test_suites/all_test_cases<br> * Data/test_suites/changed_test_cases.zip &rarr; Data/test_suites/changed_test_cases<br> * Data/test_suites/relevant_test_cases.zip &rarr; Data/test_suites/relevant_test_cases</p> <p><strong>Output:</strong><br> * Data/ATM/ASTs/all_test_cases<br> * Data/ATM/ASTs/changed_test_cases</p> <p><strong>Running the experiment:</strong><br> To generate ASTS for all test cases in the project test suites, the&nbsp;<em><strong>Code/ATM/CodeToAST/src/CodeToAST.java</strong></em>&nbsp;file should be compiled and run using the Eclipse IDE by including all the required&nbsp;<em><strong>.jar</strong></em>&nbsp;files in the&nbsp;<em><strong>Code/ATM/CodeToAST/lib</strong></em>&nbsp;directory as part of the classpath. A bash script is provided along with a pre-generated&nbsp;<em><strong>.jar</strong></em>&nbsp;file in the&nbsp;<em><strong>Code/ATM/CodeToAST/bin</strong></em>&nbsp;directory to run this step, as follows:</p> <pre><code class="language-bash">cd Code/ATM/CodeToAST bash transform_code_to_ast.sh</code></pre> <p>Each test file in the&nbsp;<em><strong>Data/test_suites/all_test_cases</strong></em>&nbsp;and&nbsp;<em><strong>Data/test_suites/changed_test_cases</strong></em>&nbsp;directories is parsed to generate a corresponding AST for each test case method (saved in an XML format in&nbsp;<strong>Data/ATM/ASTs/all_test_cases</strong>&nbsp;and&nbsp;<em><strong>Data/ATM/ASTs/changed_test_cases</strong></em>&nbsp;for each project version)<br> <strong>_________________________________</strong></p> <p><strong>ATM - Similarity Measurement:</strong></p> <p><strong>Requirements:</strong><br> * Eclipse IDE (we used 2021-12)<br> * The libraries (the&nbsp;<em><strong>.jar</strong></em><strong>&nbsp;</strong>files in the&nbsp;<em><strong>Code/ATM/Similarity/lib</strong></em>&nbsp;directory)<br> <br> <strong>Input:</strong><br> * Data/test_suites/all_test_cases<br> * Data/test_suites/changed_test_cases<br> <br> <strong>Output:</strong><br> * Data/ATM/similarity_measurements<br> <br> <strong>Running the experiment:</strong><br> To measure the similarity between each pair of test cases, the&nbsp;<em><strong>Code/ATM/Similarity/src/SimilarityMeasurement.java</strong></em>&nbsp;file should be compiled and run using the Eclipse IDE by including all the required&nbsp;<em><strong>.jar</strong></em>&nbsp;files in the&nbsp;<em><strong>Code/ATM/Similarity/lib</strong></em>&nbsp;directory as part of the classpath. A bash script is provided along with a pre-generated&nbsp;<em><strong>.jar</strong></em>&nbsp;file in the&nbsp;<em><strong>Code/ATM/Similarity/bin</strong></em>&nbsp;directory to run this step, as follows:</p> <pre><code class="language-bash">cd Code/ATM/Similarity bash measure_similarity.sh</code></pre> <p>ASTs&nbsp;of&nbsp;each project in the&nbsp;<em><strong>Data/ATM/ASTs/all_test_cases</strong></em>&nbsp;and&nbsp;<em><strong>Data/ATM/ASTs/changed_test_cases</strong></em>&nbsp;directories are parsed to create pairs of ASTs&nbsp;containing one test case from the&nbsp;<em><strong>Data/ATM/ASTs/all_test_cases</strong></em>&nbsp;directory with another test case from the&nbsp;<em><strong>Data/ATM/ASTs/changed_test_cases</strong></em>&nbsp;directory (redundant pairs are discarded). Then, all similarity measurements are saved in the&nbsp;<em><strong>Data/ATM/similarity_measurements.zip</strong></em>&nbsp;file.<br> __________________________________________</p> <p><strong>Search-based Minimization Algorithms:</strong><br> The source code for this step is in the&nbsp;<em><strong>Code/ATM/Search</strong></em>&nbsp;directory.<br> <br> <strong>Requirements:</strong><br> To run this step, Python 3 is required (we used&nbsp;<em><strong>Python 3.10</strong></em>). Also, the libraries in the&nbsp;<strong>Code/AMT/Search/requirements.txt</strong>&nbsp;file should be installed, as follows:</p> <pre><code class="language-bash">cd Code/ATM/Search pip install -r requirements.txt</code></pre> <p><strong>Input:</strong><br> * Data/ATM/similarity_measurements<br> <br> <strong>Output:</strong><br> * Results/ATM/minimization_results<br> <br> <strong>Running the experiment:</strong><br> To minimize the test suites in our dataset, the following bash script should be executed:</p> <pre><code class="language-bash">bash minimize.sh</code></pre> <p>All similarity measurements are parsed for each version of the projects, independently. Each version is run 10 times using three minimization budgets (25%, 50%, and 75%). Genetic Algorithm (GA) is run using four similarity measures, namely top-down, bottom-up, combined, and tree edit distance. NSGA-II is run using two combinations of similarity measures: top-down &amp; bottom-up and combined &amp; tree edit distance. The minimization results are generated in the&nbsp;<em><strong>Results/ATM/minimization_results</strong></em>&nbsp;directory.<br> __________________</p> <p><strong>Evaluate results:</strong><br> To evaluate and summarize the minimization results, run the following:</p> <pre><code class="language-bash">cd Code/ATM/Evaluation bash evaluate.sh</code></pre> <p>This will generate summarized&nbsp;<em>FDR</em>&nbsp;and execution time results (per-project and per-version) for each minimization budget, which can all be found in&nbsp;<strong>Results/ATM</strong>. In this replication package, we provide the final, merged&nbsp;<em>FDR</em>&nbsp;with execution time results.</p> <p><strong>_________________________________</strong></p> <p><strong>Running FAST-R experiments</strong><br> ATM was compared to&nbsp;<a href="https://github.com/ICSE19-FAST-R/FAST-R">FAST-R</a>, a state-of-the-art baseline, which is a set of test case minimization techniques called: <em>FAST++, FAST-CS, FAST-pw, and FAST-all</em>, which we adapted to our data and experimental setup.</p> <p><strong>Requirements:</strong><br> To run this step, Python 3.7 is required. Also, the libraries in the&nbsp;<em><strong>Code/FAST-R/requirements.txt</strong></em>&nbsp;file should be installed, as follows:</p> <pre><code class="language-bash">cd Code/FAST-R pip install -r requirements.txt</code></pre> <p><strong>Input:</strong><br> * Data/FAST-R/test_methods<br> * Data/FAST-R/test_classes</p> <p><strong>Output:</strong><br> * Results/FAST-R/test_methods/FDR_and_Exec_Time_Results_[budget]%_budget.csv<br> * Results/FAST-R/test_classes/FDR_and_Exec_Time_Results_[budget]%_budget.csv<br> <br> To run FAST-R experiments, the following bash script should be executed:</p> <pre><code class="language-bash">bash fast_r.sh test_methods #method level bash fast_r.sh test_classes #class level</code></pre> <p>Results are generated in&nbsp;<em><strong>.csv</strong></em>&nbsp;files for each budget. For example, for the 50% budget, results are saved in&nbsp;<strong>FDR_and_Exec_Time_Results_50%_budget.csv</strong>&nbsp;in the&nbsp;<em><strong>Results/FAST-R/test_methods</strong></em>&nbsp;and&nbsp;<em><strong>Results/FAST-R/test_classes</strong></em>&nbsp;directories.</p> <p><strong>_________________________________</strong></p> <p><strong>Running the random minimization experiments</strong><br> ATM was also compared to random minimization as a standard baseline.</p> <p><strong>Requirements:</strong>&nbsp;To run this step, Python 3 is required (we used&nbsp;<em><strong>Python 3.10</strong></em>). Also, the libraries in the&nbsp;<em><strong>Code/RandomMinimization/requirements.txt</strong></em>&nbsp;file should be installed, as follows:</p> <pre><code class="language-bash">cd Code/RandomMinimization pip install -r requirements.txt</code></pre> <p><strong>Input:</strong><br> <em>N/A</em></p> <p><strong>Output:</strong><br> * Results/RandomMinimization/FDR_and_Exec_Time_Results_[budget]%_budget.csv<br> <br> To run the random selection experiments, the following bash script should be executed:</p> <pre><code class="language-bash">bash random_minimization.sh</code></pre> <p>Results are generated in&nbsp;<em><strong>.csv</strong></em>&nbsp;files for each budget. For example, for the 50% budget, results are saved in&nbsp;<em><strong>FDR_and_Exec_Time_Results_50%_budget.csv</strong></em>&nbsp;in the&nbsp;<em><strong>Results/RandomMinimization</strong></em>&nbsp;directory.</p>

ShareScore

36/100

Overall dataset sharing score

Score breakdown

These five areas show where the dataset supports — or may limit — practical reuse.

Stewardship
8
Harmonization
4
Access
16
Reuse readiness
8
Engagement
0

Topics