|
--- |
|
license: mit |
|
configs: |
|
- config_name: default |
|
data_files: |
|
- split: train |
|
path: data/train-* |
|
- split: test |
|
path: data/test-* |
|
dataset_info: |
|
features: |
|
- name: target |
|
dtype: string |
|
- name: src_fm |
|
dtype: string |
|
- name: src_fm_fc |
|
dtype: string |
|
- name: src_fm_fc_co |
|
dtype: string |
|
- name: src_fm_fc_ms |
|
dtype: string |
|
- name: src_fm_fc_ms_ff |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 3399525755 |
|
num_examples: 624022 |
|
- name: test |
|
num_bytes: 907751466 |
|
num_examples: 156922 |
|
download_size: 558984469 |
|
dataset_size: 4307277221 |
|
task_categories: |
|
- text-generation |
|
language: |
|
- en |
|
tags: |
|
- unit test |
|
- java |
|
- code |
|
--- |
|
|
|
## Dataset Description |
|
Microsoft created this large dataset of Java Junit test cases with its corresponding focal methods. |
|
It contains 780k pairs of JUnit test cases and focal methods which were extracted from a total of 91K |
|
Java open source project hosted on GitHub. |
|
|
|
The mapping between test case and focal methods are based heuristics rules and Java developer's best practice. |
|
|
|
More information could be found here: |
|
- [methods2test Github repo](https://github.com/microsoft/methods2test) |
|
- [Methods2Test: A dataset of focal methods mapped to test cases](https://arxiv.org/pdf/2203.12776.pdf) |
|
|
|
## Dataset Schema |
|
``` |
|
target: <TEST_CASE> |
|
src_fm: <FOCAL_METHOD> |
|
src_fm_fc: <FOCAL_CLASS_NAME> <FOCAL_METHOD> |
|
src_fm_fc_co: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> |
|
src_fm_fc_ms: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES> |
|
src_fm_fc_ms_ff: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES> <FIELDS> |
|
``` |
|
|
|
## Focal Context |
|
- fm: this representation incorporates exclusively the source |
|
code of the focal method. Intuitively, this contains the most |
|
important information for generating accurate test cases for |
|
the given method. |
|
- fm+fc: this representations adds the focal class name, which |
|
can provide meaningful semantic information to the model. |
|
- fm+fc+c: this representation adds the signatures of the constructor methods of the focal class. The idea behind this |
|
augmentation is that the test case may require instantiating |
|
an object of the focal class in order to properly test the focal |
|
method. |
|
- fm+fc+c+m: this representation adds the signatures of the |
|
other public methods in the focal class. The rationale which |
|
motivated this inclusion is that the test case may need to |
|
invoke other auxiliary methods within the class (e.g., getters, |
|
setters) to set up or tear down the testing environment. |
|
- fm+fc+c+m+f : this representation adds the public fields of |
|
the focal class. The motivation is that test cases may need to |
|
inspect the status of the public fields to properly test a focal |
|
method. |
|
|
|
![image/png](https://cdn-uploads.huggingface.co/production/uploads/642382bb6e61cda1b3a20983/PYpNYXweRZyFOp6TbNkyt.png) |
|
|
|
The different levels of focal contexts are the following: |
|
``` |
|
FM: focal method |
|
FM_FC: focal method + focal class name |
|
FM_FC_CO: focal method + focal class name + constructor signatures |
|
FM_FC_MS: focal method + focal class name + constructor signatures + public method signatures |
|
FM_FC_MS_FF: focal method + focal class name + constructor signatures + public method signatures + public fields |
|
``` |
|
|
|
## Lmitations |
|
The original authors validate the heuristics by inspecting a |
|
statistically significant sample (confidence level of 95% within 10% |
|
margin of error) of 97 samples from the training set. Two authors |
|
independently evaluated the sample, then met to discuss the disagreements. We found that 90.72% of the samples have a correct |
|
link between the test case and the corresponding focal method |
|
|
|
## Contribution |
|
All the thanks to the original authors. |