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(Python依赖管理工具) 实验运行步骤: 下载您希望运行的实验压缩包single_parameter_experiment.zip 或 multi_parameter_experiment.zip。 解压该压缩包。 打开终端并进入解压后的文件夹,例如执行 cd single_parameter_experiment。 运行 poetry install --only main 命令安装所有依赖项。 如需运行实验,执行 poetry run python run_experiment.py 命令。 所有实验结果均可在 data/ 文件夹中找到。 本次实验所用模块定义于 experiment_modules.py 文件中,如需查看实验配置,请查阅 run_experiment.py。 警告:单台机器运行实验需耗时数周,因此建议按模块拆分实验并并行运行。 运行分析 运行分析的前置条件: Conda(Python环境管理工具) 分析运行步骤: 下载分析压缩包analysis-adaptive-parameter-control.zip。 解压该压缩包。 打开终端并进入解压后的文件夹,例如执行 cd analysis-adaptive-parameter-control。 运行以下命令以创建Conda环境并安装所有依赖项: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/ 文件夹。 打开所选的笔记本文件: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。 定位到名为“数据分析”的章节,并按顺序运行所有单元格。 (可选)分析前本地运行贝叶斯模型 进入 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。 定位到名为“模型规范”的章节,并运行该章节下的三个笔记本单元格。 警告:该操作将耗时较长,若时间不足,请使用以下替代方案 数据 我们运行实验时产生的数据可在 Single data.zip 和 Multi data.zip 文件中获取。 这些文件的结构如下: 每个实验模块对应一个文件夹,进一步划分为每个独立运行的子文件夹。所有这些子文件夹均包含: 覆盖率报告。 本次独立运行的完整日志。 测试生成过程中受控参数值的时间线。 本次运行的完整 Pynguin(Python自动测试生成工具)配置。 生成的测试套件。 另有一个 statistics.csv 文件,包含各次运行的相关信息及其分支覆盖率时间线。 运行参数分配分析 运行参数分配分析的前置条件: Conda(Python环境管理工具) 参数分配分析运行步骤: 下载分析压缩包parameter-assignment.zip。 解压该压缩包。 打开终端并进入解压后的文件夹,例如执行 cd parameter-assignment。 运行以下命令以创建Conda环境并安装所有依赖项:conda env create -f environment.yml 进入 Notebooks/ 文件夹。 打开 parameter_assignment_analysis.ipynb 笔记本文件。 按顺序运行所有单元格。



