methods2test/scripts
Michele Tufano 574b84b633 scripts readme 2022-01-20 00:56:30 +00:00
..
README.md scripts readme 2022-01-20 00:56:30 +00:00
TestParser.py scripts for extraction and mapping 2022-01-20 00:46:04 +00:00
find_map_test_cases.py scripts for extraction and mapping 2022-01-20 00:46:04 +00:00
java-grammar.so scripts for extraction and mapping 2022-01-20 00:46:04 +00:00

README.md

The script folder contains the following files:

  • find_map_test_cases.py: the main script to find and map test cases in a repository
  • TestParser.py: an utility class that parses test cases
  • java-grammar.so: tree-sitter Java grammar file

Extraction & Mapping

To extract test cases and map them to focal methods, we can run the find_map_test_cases.py script, which takes the following arguments:

  • --repo_url: GitHub URL of the repo to analyze
  • --repo_id: ID used to refer to the repo
  • --grammar: Filepath of the tree-sitter grammar
  • --tmp: Path to a temporary folder used for processing
  • --output: Path to the output folder

Example

Let us analyze the Apache Hadoop project (url: https://github.com/apache/hadoop), extract and map test cases using this command:

python find_map_test_cases.py 
    --repo_url https://github.com/apache/hadoop
    --repo_id 23418517  
    --grammar ./java-grammar.so 
    --tmp /tmp/tmp/ 
    --output /tmp/output/