Adaptive Parameter Control for Search-Based Unit Test Generation — Replication Package
收藏资源简介:
Running the experiments Prerequisites for running the experiments: Docker Poetry Steps to run the experiments: Download the experiment zip file you wish to run (single_parameter_experiment.zip or multi_parameter_experiment.zip). Un-zip the file. Open a terminal and navigate to the unzipped folder (e.g. cd single_parameter_experiment). Run poetry install --only main to install all dependencies. To run the experiment, run poetry run python run_experiment.py. All results can be found in the folder data/. The modules used for the experiment are defined in the file experiment_modules.py and to see the experiment configuration, look in run_experiment.py. Warning: the experiments take several weeks to run on a single machine, therefore it is advisable to split the experiments based on modules and run them in parallel. Running the analysis Prerequisites for running the analysis: Conda Steps to run the analysis: Download the analysis zip file (analysis-adaptive-parameter-control.zip). Un-zip the file. Open a terminal and navigate to the unzipped folder (e.g. cd analysis-adaptive-parameter-control). Run the following command to install the conda environment and all dependencies: conda env create -f environment.yml If you want to re-run the Bayesian models locally on your machine, follow the optional step below, otherwise download and unzip the trace data from the replication package, i.e., Trace data single.zip and Trace data multi.zip. Place the .nc files in the corresponding folder: analysis-adaptive-parameter-control/single_parameter/ or analysis-adaptive-parameter-control/multi_parameter/. E.g. the coverage_rate_model_single_parameter.nc goes in the single_parameter folder, while the coverage_rate_model_multi_parameter.nc goes in the multi_parameter folder. Navigate to the notebooks folder (Notebooks/). Open a notebook of choice (coverage_rate_multi_parameter.ipynb, coverage_rate_single_parameter.ipynb, final_coverage_multi_parameter.ipynb, final_coverage_single_parameter.ipynb, overhead_model_multi_parameter.ipynb, or overhead_model_single_parameter.ipynb). Navigate to the section called "Data analysis" and run all cells in order. (Optional) Running the Bayesian models locally before the analysis. Navigate to the notebooks folder (Notebooks/). Open a notebook of choice (coverage_rate_multi_parameter.ipynb, coverage_rate_single_parameter.ipynb, final_coverage_multi_parameter.ipynb, final_coverage_single_parameter.ipynb, overhead_model_multi_parameter.ipynb, or overhead_model_single_parameter.ipynb). Navigate to the section called "Model specification" and run the three notebook cells. Warning: this will take a long time, if you don't have the time, use the following alternative instead Data The data from when we ran the experiments is available in the Single data.zip and Multi data.zip files. The structure of these are the following: There are folders for each module the experiment was run on, further divided into each unique run. All these folders include: Coverage reports. Complete logs for the unique run. A timeline over controlled parameter values during the test generation process. The complete Pynguin configuration for the run. The generated test suite. There is one statistics.csv file containing some information about each run and their branch coverage timelines. Running the parameter assignment analysis Prerequisites for running the parameter assignment analysis: Conda Steps to run the parameter assignment analysis: Download the analysis zip file (parameter-assignment.zip). Un-zip the file. Open a terminal and navigate to the unzipped folder (e.g. cd parameter-assignment). Run the following command to install the conda environment and all dependencies: conda env create -f environment.yml Navigate to the notebooks folder (Notebooks/). Open the notebook parameter_assignment_analysis.ipynb. Run all cells in order.
实验运行说明 ## 实验运行前置依赖 Docker、Poetry ## 实验运行步骤 1. 下载所需运行的实验压缩包(single_parameter_experiment.zip 或 multi_parameter_experiment.zip)。 2. 解压该压缩包。 3. 打开终端并切换至解压后的文件夹(例如执行 `cd single_parameter_experiment` 命令)。 4. 执行 `poetry install --only main` 命令安装所有依赖项。 5. 运行实验请执行 `poetry run python run_experiment.py`。 6. 所有实验结果均可在 `data/` 文件夹中找到。 实验所用模块定义于 `experiment_modules.py` 文件中,若需查看实验配置,请参阅 `run_experiment.py` 文件。 > 注意:单台机器运行全部实验需耗时数周,因此建议按模块拆分实验并并行执行。 --- # 分析运行说明 ## 分析运行前置依赖 Conda ## 分析运行步骤 1. 下载分析压缩包(analysis-adaptive-parameter-control.zip)。 2. 解压该压缩包。 3. 打开终端并切换至解压后的文件夹(例如执行 `cd analysis-adaptive-parameter-control` 命令)。 4. 执行以下命令创建Conda环境并安装所有依赖项: bash conda env create -f environment.yml 若需在本地重新运行贝叶斯模型,请执行下述可选步骤;否则请从复现包中下载并解压追踪数据:`Trace data single.zip` 与 `Trace data multi.zip`。 将 `.nc` 格式文件放置至对应文件夹:`analysis-adaptive-parameter-control/single_parameter/` 或 `analysis-adaptive-parameter-control/multi_parameter/`。例如,`coverage_rate_model_single_parameter.nc` 需放入 `single_parameter` 文件夹,`coverage_rate_model_multi_parameter.nc` 则需放入 `multi_parameter` 文件夹。 切换至 `notebooks` 文件夹(`Notebooks/`)。选择并打开对应笔记本文件(可选文件包括 `coverage_rate_multi_parameter.ipynb`、`coverage_rate_single_parameter.ipynb`、`final_coverage_multi_parameter.ipynb`、`final_coverage_single_parameter.ipynb`、`overhead_model_multi_parameter.ipynb` 或 `overhead_model_single_parameter.ipynb`)。跳转至名为“Data analysis”的章节,并按顺序运行所有单元格。 ### (可选)分析前本地运行贝叶斯模型 切换至 `notebooks` 文件夹(`Notebooks/`)。选择并打开对应笔记本文件(同上列可选文件)。跳转至名为“Model specification”的章节,并运行其中的三个单元格。 > 注意:该操作耗时较长,若时间有限可采用下述替代方案。 --- # 数据集说明 实验运行产生的原始数据可于 `Single data.zip` 与 `Multi data.zip` 文件中获取。其目录结构如下:按实验所涉及的每个模块划分文件夹,每个模块下进一步按唯一运行批次划分子文件夹。所有子文件夹均包含以下内容:覆盖率报告、该次运行的完整日志、测试生成过程中受控参数值的时间线记录、本次运行的完整 Pynguin 配置、生成的测试套件。此外还包含一个 `statistics.csv` 文件,其中记录了各运行批次的相关信息及其分支覆盖率时间线数据。 --- # 参数分配分析运行说明 ## 参数分配分析前置依赖 Conda ## 参数分配分析运行步骤 1. 下载分析压缩包(parameter-assignment.zip)。 2. 解压该压缩包。 3. 打开终端并切换至解压后的文件夹(例如执行 `cd parameter-assignment` 命令)。 4. 执行以下命令创建Conda环境并安装所有依赖项: bash conda env create -f environment.yml 5. 切换至 `notebooks` 文件夹(`Notebooks/`)。 6. 打开 `parameter_assignment_analysis.ipynb` 笔记本文件,并按顺序运行所有单元格。



