|
--- |
|
language: |
|
- en |
|
license: mit |
|
task_categories: |
|
- text-generation |
|
configs: |
|
- config_name: fm |
|
data_files: |
|
- split: train |
|
path: data/fm/train-* |
|
- split: test |
|
path: data/fm/test-* |
|
- split: validation |
|
path: data/fm/validation-* |
|
- config_name: fm_indented |
|
data_files: |
|
- split: train |
|
path: data/fm_indented/train-* |
|
- split: test |
|
path: data/fm_indented/test-* |
|
- split: validation |
|
path: data/fm_indented/validation-* |
|
- config_name: fm+t |
|
data_files: |
|
- split: train |
|
path: data/fm+t/train-* |
|
- split: test |
|
path: data/fm+t/test-* |
|
- split: validation |
|
path: data/fm+t/validation-* |
|
- config_name: fm+fc |
|
data_files: |
|
- split: train |
|
path: data/fm+fc/train-* |
|
- split: test |
|
path: data/fm+fc/test-* |
|
- split: validation |
|
path: data/fm+fc/validation-* |
|
- config_name: fm+fc+t+tc |
|
data_files: |
|
- split: train |
|
path: data/fm+fc+t+tc/train-* |
|
- split: test |
|
path: data/fm+fc+t+tc/test-* |
|
- split: validation |
|
path: data/fm+fc+t+tc/validation-* |
|
- config_name: fm+fc+c |
|
data_files: |
|
- split: train |
|
path: data/fm+fc+c/train-* |
|
- split: test |
|
path: data/fm+fc+c/test-* |
|
- split: validation |
|
path: data/fm+fc+c/validation-* |
|
- config_name: fm+fc+c+t+tc |
|
data_files: |
|
- split: train |
|
path: data/fm+fc+c+t+tc/train-* |
|
- split: test |
|
path: data/fm+fc+c+t+tc/test-* |
|
- split: validation |
|
path: data/fm+fc+c+t+tc/validation-* |
|
- config_name: fm+fc+c+m |
|
data_files: |
|
- split: train |
|
path: data/fm+fc+c+m/train-* |
|
- split: test |
|
path: data/fm+fc+c+m/test-* |
|
- split: validation |
|
path: data/fm+fc+c+m/validation-* |
|
- config_name: fm+fc+c+m+t+tc |
|
data_files: |
|
- split: train |
|
path: data/fm+fc+c+m+t+tc/train-* |
|
- split: test |
|
path: data/fm+fc+c+m+t+tc/test-* |
|
- split: validation |
|
path: data/fm+fc+c+m+t+tc/validation-* |
|
- config_name: fm+fc+c+m+f |
|
data_files: |
|
- split: train |
|
path: data/fm+fc+c+m+f/train-* |
|
- split: test |
|
path: data/fm+fc+c+m+f/test-* |
|
- split: validation |
|
path: data/fm+fc+c+m+f/validation-* |
|
- config_name: fm+fc+c+m+f+t+tc |
|
data_files: |
|
- split: train |
|
path: data/fm+fc+c+m+f+t+tc/train-* |
|
- split: test |
|
path: data/fm+fc+c+m+f+t+tc/test-* |
|
- split: validation |
|
path: data/fm+fc+c+m+f+t+tc/validation-* |
|
- config_name: t |
|
data_files: |
|
- split: train |
|
path: data/t/train-* |
|
- split: test |
|
path: data/t/test-* |
|
- split: validation |
|
path: data/t/validation-* |
|
- config_name: t_indented |
|
data_files: |
|
- split: train |
|
path: data/t_indented/train-* |
|
- split: test |
|
path: data/t_indented/test-* |
|
- split: validation |
|
path: data/t_indented/validation-* |
|
- config_name: t+tc |
|
data_files: |
|
- split: train |
|
path: data/t+tc/train-* |
|
- split: test |
|
path: data/t+tc/test-* |
|
- split: validation |
|
path: data/t+tc/validation-* |
|
dataset_info: |
|
- config_name: fm |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: text |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 4696431 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 642347 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 662917 |
|
num_examples: 953 |
|
download_size: 2633268 |
|
dataset_size: 6001695 |
|
- config_name: fm+fc |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: text |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 5387123 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 738049 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 757167 |
|
num_examples: 953 |
|
download_size: 2925807 |
|
dataset_size: 6882339 |
|
- config_name: fm+fc+c |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: text |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 5906873 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 820149 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 824441 |
|
num_examples: 953 |
|
download_size: 3170873 |
|
dataset_size: 7551463 |
|
- config_name: fm+fc+c+m |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: text |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 11930672 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 1610045 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 1553249 |
|
num_examples: 953 |
|
download_size: 5406454 |
|
dataset_size: 15093966 |
|
- config_name: fm+fc+c+m+f |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: text |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 12722890 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 1713683 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 1654607 |
|
num_examples: 953 |
|
download_size: 5753116 |
|
dataset_size: 16091180 |
|
- config_name: fm+fc+c+m+f+t+tc |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: source |
|
dtype: string |
|
- name: target |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 18332635 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 2461169 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 2510969 |
|
num_examples: 953 |
|
download_size: 8280985 |
|
dataset_size: 23304773 |
|
- config_name: fm+fc+c+m+t+tc |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: source |
|
dtype: string |
|
- name: target |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 17537661 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 2357359 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 2409506 |
|
num_examples: 953 |
|
download_size: 8178222 |
|
dataset_size: 22304526 |
|
- config_name: fm+fc+c+t+tc |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: source |
|
dtype: string |
|
- name: target |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 11445562 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 1565365 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 1676986 |
|
num_examples: 953 |
|
download_size: 5944482 |
|
dataset_size: 14687913 |
|
- config_name: fm+fc+t+tc |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: source |
|
dtype: string |
|
- name: target |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 10923038 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 1483265 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 1609296 |
|
num_examples: 953 |
|
download_size: 5715335 |
|
dataset_size: 14015599 |
|
- config_name: fm+t |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: source |
|
dtype: string |
|
- name: target |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 8889443 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 1207763 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 1336798 |
|
num_examples: 953 |
|
download_size: 4898458 |
|
dataset_size: 11434004 |
|
- config_name: fm_indented |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: text |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 5054397 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 692948 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 714462 |
|
num_examples: 953 |
|
download_size: 2703115 |
|
dataset_size: 6461807 |
|
- config_name: t |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: source |
|
dtype: string |
|
- name: target |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 4316096 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 582266 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 689647 |
|
num_examples: 953 |
|
download_size: 2434024 |
|
dataset_size: 5588009 |
|
- config_name: t+tc |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: source |
|
dtype: string |
|
- name: target |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 5648321 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 761386 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 867350 |
|
num_examples: 953 |
|
download_size: 3024686 |
|
dataset_size: 7277057 |
|
- config_name: t_indented |
|
features: |
|
- name: id |
|
dtype: string |
|
- name: source |
|
dtype: string |
|
- name: target |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 4606253 |
|
num_examples: 7440 |
|
- name: test |
|
num_bytes: 623576 |
|
num_examples: 1017 |
|
- name: validation |
|
num_bytes: 734221 |
|
num_examples: 953 |
|
download_size: 2496661 |
|
dataset_size: 5964050 |
|
tags: |
|
- unit test |
|
- java |
|
- code |
|
--- |
|
|
|
## Dataset Description |
|
Microsoft created the methods2test dataset, consisting of Java Junit test cases with their 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 projects hosted on GitHub. |
|
|
|
This is a smaller subset of the assembled version of the methods2test dataset. |
|
It provides convenient access to the different context levels based on the raw source code (e.g. newlines are preserved). The test cases and associated classes are also made available. |
|
The subset is created by randomly selecting only one sample from each of the 91k projects. |
|
|
|
The mapping between test case and focal methods is based on heuristics rules and Java developer's best practice. |
|
More information can 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 |
|
``` |
|
t: <TEST_CASE> |
|
t+tc: <TEST_CLASS_NAME> <TEST_CASE> |
|
fm: <FOCAL_METHOD> |
|
fm+t: <FOCAL_METHOD> |
|
fm+fc: <FOCAL_CLASS_NAME> <FOCAL_METHOD> |
|
fm+fc: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <TEST_CLASS_NAME> <TEST_CASE> |
|
fm+fc+c: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> |
|
fm+fc+c: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <TEST_CLASS_NAME> <TEST_CASE> |
|
fm+fc+c+m: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES> |
|
fm+fc+c+m: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES> <TEST_CLASS_NAME> <TEST_CASE> |
|
fm+fc+c+m+f: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES> <FIELDS> |
|
fm+fc+c+m+f+t+tc: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES> <FIELDS> <TEST_CLASS_NAME> <TEST_CASE> |
|
``` |
|
|
|
## 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 representation 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 that 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. |
|
|
|
The test case along with the class name is also provided for each focal context. |
|
|
|
![image/pdf](https://huggingface.co/datasets/andstor/methods2test/resolve/main/focal_context.png) |
|
|
|
The different levels of focal contexts are the following: |
|
``` |
|
fm: focal method |
|
fm+fc: focal method + focal class name |
|
fm+fc+c: focal method + focal class name + constructor signatures |
|
fm+fc+c+m: focal method + focal class name + constructor signatures + public method signatures |
|
fm+fc+c+m+f: focal method + focal class name + constructor signatures + public method signatures + public fields |
|
``` |
|
|