File size: 12,116 Bytes
099d832 506e80f 6fc7adc 506e80f f2b208f 1bc50c0 c9f0699 f2b208f c9f0699 f2b208f c9f0699 f2b208f c9f0699 fdb48a9 c9f0699 f2b208f c9f0699 f2b208f c9f0699 f2b208f c9f0699 e44f954 f2b208f e44f954 f2b208f e44f954 f2b208f e44f954 7cbacc9 c9f0699 f2b208f c9f0699 f2b208f c9f0699 f2b208f c9f0699 e44f954 f2b208f e44f954 f2b208f e44f954 f2b208f e44f954 7cbacc9 c9f0699 f2b208f c9f0699 f2b208f c9f0699 f2b208f c9f0699 e44f954 f2b208f e44f954 f2b208f e44f954 f2b208f e44f954 7cbacc9 c9f0699 f2b208f c9f0699 f2b208f c9f0699 f2b208f c9f0699 e44f954 f2b208f e44f954 f2b208f e44f954 f2b208f e44f954 85c3524 18b07d7 3aaab2c 5178d94 c9f0699 3aaab2c c9f0699 3aaab2c c9f0699 3aaab2c c9f0699 7409f7a c9f0699 85c3524 96ae3a9 d310ab5 96ae3a9 6fc7adc 099d832 6fc7adc b0239e2 6fc7adc c9f0699 6fc7adc c9f0699 6fc7adc c9f0699 6fc7adc c9f0699 6fc7adc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
---
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: 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: text
dtype: string
splits:
- name: train
num_bytes: 18218367
num_examples: 7440
- name: test
num_bytes: 2454151
num_examples: 1017
- name: validation
num_bytes: 2502379
num_examples: 953
- name: generate
num_bytes: 1915177
num_examples: 1017
download_size: 8717371
dataset_size: 25090074
- config_name: fm+fc+c+m+t+tc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 17426149
num_examples: 7440
- name: test
num_bytes: 2350513
num_examples: 1017
- name: validation
num_bytes: 2401021
num_examples: 953
- name: generate
num_bytes: 1811539
num_examples: 1017
download_size: 8624984
dataset_size: 23989222
- config_name: fm+fc+c+t+tc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 11402350
num_examples: 7440
- name: test
num_bytes: 1560617
num_examples: 1017
- name: validation
num_bytes: 1672213
num_examples: 953
- name: generate
num_bytes: 1021643
num_examples: 1017
download_size: 6175964
dataset_size: 15656823
- config_name: fm+fc+t+tc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 10882600
num_examples: 7440
- name: test
num_bytes: 1478517
num_examples: 1017
- name: validation
num_bytes: 1604939
num_examples: 953
- name: generate
num_bytes: 939543
num_examples: 1017
download_size: 5926176
dataset_size: 14905599
- config_name: fm+t
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 8859676
num_examples: 7440
- name: test
num_bytes: 1203645
num_examples: 1017
- name: validation
num_bytes: 1332986
num_examples: 953
- name: generate
num_bytes: 702248
num_examples: 1017
download_size: 5065578
dataset_size: 12098555
- 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: text
dtype: string
splits:
- name: train
num_bytes: 4286329
num_examples: 7440
- name: test
num_bytes: 578148
num_examples: 1017
- name: validation
num_bytes: 685835
num_examples: 953
- name: generate
num_bytes: 76751
num_examples: 1017
download_size: 2483161
dataset_size: 5627063
- config_name: t+tc
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 5618561
num_examples: 7440
- name: test
num_bytes: 757318
num_examples: 1017
- name: validation
num_bytes: 863538
num_examples: 953
- name: generate
num_bytes: 218344
num_examples: 1017
download_size: 3052841
dataset_size: 7457761
- config_name: t_indented
features:
- name: id
dtype: string
- name: text
dtype: string
splits:
- name: train
num_bytes: 4576493
num_examples: 7440
- name: test
num_bytes: 619508
num_examples: 1017
- name: validation
num_bytes: 730409
num_examples: 953
- name: generate
num_bytes: 83585
num_examples: 1017
download_size: 2503838
dataset_size: 6009995
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 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 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
```
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.
![image/png](https://huggingface.co/datasets/andstor/methods2test/resolve/main/figure-1-focal-context.png)
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.
|