The dataset viewer is not available for this dataset.
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
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:
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.
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
- Downloads last month
- 242
