Datasets:
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-*
- split: generate
path: data/fm+t/generate-*
- 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-*
- split: generate
path: data/fm+fc+t+tc/generate-*
- 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-*
- split: generate
path: data/fm+fc+c+t+tc/generate-*
- 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-*
- split: generate
path: data/fm+fc+c+m+t+tc/generate-*
- 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-*
- split: generate
path: data/fm+fc+c+m+f+t+tc/generate-*
- config_name: t
data_files:
- split: train
path: data/t/train-*
- split: test
path: data/t/test-*
- split: validation
path: data/t/validation-*
- split: generate
path: data/t/generate-*
- 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-*
- split: generate
path: data/t_indented/generate-*
- 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-*
- split: generate
path: data/t+tc/generate-*
dataset_info:
- config_name: fm
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 440444124
num_examples: 624022
- name: test
num_bytes: 59407291
num_examples: 78388
- name: validation
num_bytes: 57170315
num_examples: 78534
download_size: 99172217
dataset_size: 557021730
- config_name: fm+fc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 506130678
num_examples: 624022
- name: test
num_bytes: 68407490
num_examples: 78388
- name: validation
num_bytes: 65318956
num_examples: 78534
download_size: 109141139
dataset_size: 639857124
- config_name: fm+fc+c
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 569209100
num_examples: 624022
- name: test
num_bytes: 75552573
num_examples: 78388
- name: validation
num_bytes: 73101169
num_examples: 78534
download_size: 117996353
dataset_size: 717862842
- config_name: fm+fc+c+m
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 1354004338
num_examples: 624022
- name: test
num_bytes: 187724929
num_examples: 78388
- name: validation
num_bytes: 184349299
num_examples: 78534
download_size: 222922572
dataset_size: 1726078566
- config_name: fm+fc+c+m+f
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 1476073209
num_examples: 624022
- name: test
num_bytes: 201686811
num_examples: 78388
- name: validation
num_bytes: 201259950
num_examples: 78534
download_size: 240405885
dataset_size: 1879019970
- config_name: fm+fc+c+m+f+t+tc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 2013540433
num_examples: 624022
- name: test
num_bytes: 268328542
num_examples: 78388
- name: validation
num_bytes: 272296603
num_examples: 78534
- name: generate
num_bytes: 223846610
num_examples: 78388
download_size: 405887692
dataset_size: 2778012188
- config_name: fm+fc+c+m+t+tc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 1891471562
num_examples: 624022
- name: test
num_bytes: 254366660
num_examples: 78388
- name: validation
num_bytes: 255385952
num_examples: 78534
- name: generate
num_bytes: 209884728
num_examples: 78388
download_size: 393096987
dataset_size: 2611108902
- config_name: fm+fc+c+t+tc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 1106676324
num_examples: 624022
- name: test
num_bytes: 142194304
num_examples: 78388
- name: validation
num_bytes: 144137822
num_examples: 78534
- name: generate
num_bytes: 97712372
num_examples: 78388
download_size: 267721715
dataset_size: 1490720822
- config_name: fm+fc+t+tc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 1043597902
num_examples: 624022
- name: test
num_bytes: 135049221
num_examples: 78388
- name: validation
num_bytes: 136355609
num_examples: 78534
- name: generate
num_bytes: 90567289
num_examples: 78388
download_size: 257900021
dataset_size: 1405570021
- config_name: fm+t
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 865536041
num_examples: 624022
- name: test
num_bytes: 114056150
num_examples: 78388
- name: validation
num_bytes: 112374083
num_examples: 78534
- name: generate
num_bytes: 0
num_examples: 0
download_size: 216811797
dataset_size: 1091966274
- config_name: fm_indented
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 473170158
num_examples: 624022
- name: test
num_bytes: 64280367
num_examples: 78388
- name: validation
num_bytes: 61093848
num_examples: 78534
download_size: 103174190
dataset_size: 598544373
- config_name: t
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 377693417
num_examples: 624022
- name: test
num_bytes: 47678492
num_examples: 78388
- name: validation
num_bytes: 49493830
num_examples: 78534
- name: generate
num_bytes: 6353364
num_examples: 78388
download_size: 113846817
dataset_size: 481219103
- config_name: t+tc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 548456966
num_examples: 624022
- name: test
num_bytes: 68008425
num_examples: 78388
- name: validation
num_bytes: 72412710
num_examples: 78534
- name: generate
num_bytes: 23526493
num_examples: 78388
download_size: 138904736
dataset_size: 712404594
- config_name: t_indented
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 403355625
num_examples: 624022
- name: test
num_bytes: 51142477
num_examples: 78388
- name: validation
num_bytes: 52656292
num_examples: 78534
- name: generate
num_bytes: 6895709
num_examples: 78388
download_size: 117633676
dataset_size: 514050103
tags:
- unit test
- java
- code
Dataset Description
Microsoft created the methods2test dataset, consisting 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.
This is an 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 mapping between test case and focal methods are based heuristics rules and Java developer's best practice.
More information could be found here:
Dataset Schema
t: <TEST_CASE>
t_tc: <TEST_CASE> <TEST_CLASS_NAME>
fm: <FOCAL_METHOD>
fm_fc: <FOCAL_CLASS_NAME> <FOCAL_METHOD>
fm_fc_c: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS>
fm_fc_c_m: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES>
fm_fc_c_m_f: <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.
The different levels of focal contexts are the following:
T: test case
T_TC: test case + test class name
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
Limitations
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 thanks to the original authors.