Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
10M - 100M
ArXiv:
License:
Update README.md
Browse files
README.md
CHANGED
@@ -39,4 +39,80 @@ configs:
|
|
39 |
path: data/test-*
|
40 |
- split: validation
|
41 |
path: data/validation-*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
path: data/test-*
|
40 |
- split: validation
|
41 |
path: data/validation-*
|
42 |
+
task_categories:
|
43 |
+
- text-generation
|
44 |
+
language:
|
45 |
+
- en
|
46 |
+
tags:
|
47 |
+
- unit test
|
48 |
+
- java
|
49 |
+
- code
|
50 |
---
|
51 |
+
|
52 |
+
## Dataset Description
|
53 |
+
Microsoft created the methods2test dataset, consisting of Java Junit test cases with its corresponding focal methods.
|
54 |
+
It contains 780k pairs of JUnit test cases and focal methods which were extracted from a total of 91K
|
55 |
+
Java open source project hosted on GitHub.
|
56 |
+
|
57 |
+
This is an alternative 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.
|
58 |
+
|
59 |
+
The mapping between test case and focal methods are based heuristics rules and Java developer's best practice.
|
60 |
+
|
61 |
+
More information could be found here:
|
62 |
+
- [methods2test Github repo](https://github.com/microsoft/methods2test)
|
63 |
+
- [Methods2Test: A dataset of focal methods mapped to test cases](https://arxiv.org/pdf/2203.12776.pdf)
|
64 |
+
|
65 |
+
## Dataset Schema
|
66 |
+
```
|
67 |
+
t: <TEST_CASE>
|
68 |
+
t_tc: <TEST_CASE> <TEST_CLASS_NAME>
|
69 |
+
fm: <FOCAL_METHOD>
|
70 |
+
fm_fc: <FOCAL_CLASS_NAME> <FOCAL_METHOD>
|
71 |
+
fm_fc_c: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS>
|
72 |
+
fm_fc_c_m: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES>
|
73 |
+
fm_fc_c_m_f: <FOCAL_CLASS_NAME> <FOCAL_METHOD> <CONTRSUCTORS> <METHOD_SIGNATURES> <FIELDS>
|
74 |
+
```
|
75 |
+
|
76 |
+
## Focal Context
|
77 |
+
- fm: this representation incorporates exclusively the source
|
78 |
+
code of the focal method. Intuitively, this contains the most
|
79 |
+
important information for generating accurate test cases for
|
80 |
+
the given method.
|
81 |
+
- fm+fc: this representations adds the focal class name, which
|
82 |
+
can provide meaningful semantic information to the model.
|
83 |
+
- fm+fc+c: this representation adds the signatures of the constructor methods of the focal class. The idea behind this
|
84 |
+
augmentation is that the test case may require instantiating
|
85 |
+
an object of the focal class in order to properly test the focal
|
86 |
+
method.
|
87 |
+
- fm+fc+c+m: this representation adds the signatures of the
|
88 |
+
other public methods in the focal class. The rationale which
|
89 |
+
motivated this inclusion is that the test case may need to
|
90 |
+
invoke other auxiliary methods within the class (e.g., getters,
|
91 |
+
setters) to set up or tear down the testing environment.
|
92 |
+
- fm+fc+c+m+f : this representation adds the public fields of
|
93 |
+
the focal class. The motivation is that test cases may need to
|
94 |
+
inspect the status of the public fields to properly test a focal
|
95 |
+
method.
|
96 |
+
|
97 |
+
![image/png](https://huggingface.co/datasets/andstor/methods2test/resolve/main/figure-1-focal-context.png)
|
98 |
+
|
99 |
+
The different levels of focal contexts are the following:
|
100 |
+
```
|
101 |
+
T: test case
|
102 |
+
T_TC: test case + test class name
|
103 |
+
FM: focal method
|
104 |
+
FM_FC: focal method + focal class name
|
105 |
+
FM_FC_C: focal method + focal class name + constructor signatures
|
106 |
+
FM_FC_C_M: focal method + focal class name + constructor signatures + public method signatures
|
107 |
+
FM_FC_C_M_F: focal method + focal class name + constructor signatures + public method signatures + public fields
|
108 |
+
```
|
109 |
+
|
110 |
+
## Limitations
|
111 |
+
The original authors validate the heuristics by inspecting a
|
112 |
+
statistically significant sample (confidence level of 95% within 10%
|
113 |
+
margin of error) of 97 samples from the training set. Two authors
|
114 |
+
independently evaluated the sample, then met to discuss the disagreements. We found that 90.72% of the samples have a correct
|
115 |
+
link between the test case and the corresponding focal method
|
116 |
+
|
117 |
+
## Contribution
|
118 |
+
All thanks to the original authors.
|