jitx/Methods2Test_java_unit_test_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 Methods2Test: A dataset of focal methods… See the full description on the dataset page: https://huggingface.co/datasets/jitx/Methods2Test_java_unit_test_code.
18456
1---2license: mit3configs:4- config_name: default5 data_files:6 - split: train7 path: data/train-*8 - split: test9 path: data/test-*10dataset_info:11 features:12 - name: target13 dtype: string14 - name: src_fm15 dtype: string16 - name: src_fm_fc17 dtype: string18 - name: src_fm_fc_co19 dtype: string20 - name: src_fm_fc_ms21 dtype: string22 - name: src_fm_fc_ms_ff23 dtype: string24 splits:25 - name: train26 num_bytes: 339952575527 num_examples: 62402228 - name: test29 num_bytes: 90775146630 num_examples: 15692231 download_size: 55898446932 dataset_size: 430727722133task_categories:34- text-generation35language:36- en37tags:38- unit test39- java40- code41---42 43## Dataset Description44Microsoft created this large dataset of Java Junit test cases with its corresponding focal methods. 45It contains 780k pairs of JUnit test cases and focal methods which were extracted from a total of 91K46Java open source project hosted on GitHub. 47 48The mapping between test case and focal methods are based heuristics rules and Java developer's best practice.49 50More information could be found here:51- [methods2test Github repo](https://github.com/microsoft/methods2test)52- [Methods2Test: A dataset of focal methods mapped to test cases](https://arxiv.org/pdf/2203.12776.pdf)53 54## Dataset Schema55```56target: <TEST_CASE>57src_fm: <FOCAL_METHOD>58src_fm_fc: <FOCAL_CLASS_NAME> <FOCAL_METHOD>59src_fm_fc_co: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS>60src_fm_fc_ms: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES>61src_fm_fc_ms_ff: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES> <FIELDS>62```63 64## Focal Context65- fm: this representation incorporates exclusively the source66code of the focal method. Intuitively, this contains the most67important information for generating accurate test cases for68the given method.69- fm+fc: this representations adds the focal class name, which70can provide meaningful semantic information to the model.71- fm+fc+c: this representation adds the signatures of the constructor methods of the focal class. The idea behind this72augmentation is that the test case may require instantiating73an object of the focal class in order to properly test the focal74method.75- fm+fc+c+m: this representation adds the signatures of the76other public methods in the focal class. The rationale which77motivated this inclusion is that the test case may need to78invoke other auxiliary methods within the class (e.g., getters,79setters) to set up or tear down the testing environment.80- fm+fc+c+m+f : this representation adds the public fields of81the focal class. The motivation is that test cases may need to82inspect the status of the public fields to properly test a focal83method.84 8586 87 The different levels of focal contexts are the following:88```89FM: focal method90FM_FC: focal method + focal class name91FM_FC_CO: focal method + focal class name + constructor signatures92FM_FC_MS: focal method + focal class name + constructor signatures + public method signatures93FM_FC_MS_FF: focal method + focal class name + constructor signatures + public method signatures + public fields94```95 96## Lmitations97The original authors validate the heuristics by inspecting a98statistically significant sample (confidence level of 95% within 10%99margin of error) of 97 samples from the training set. Two authors100independently evaluated the sample, then met to discuss the disagreements. We found that 90.72% of the samples have a correct101link between the test case and the corresponding focal method102 103## Contribution104All the thanks to the original authors.