go-test-parser
An advanced research tool for identifying and analyzing unit tests in Go projects.

Features
- Parse and analyze Go test files.
- Generate detailed reports on test statistics and analysis.
- Support for various output formats, including CSV and plaintext.
Quick Start
Download the latest binary for your operating system from the Releases page.
Application Options
Below is a list of the command-line options supported by the application:
Option |
Description |
Default Value |
Example Argument |
--project / -p |
Path to the Go project directory to be parsed |
Required |
C:/programs/my-go-project , ./other-project |
--output / -o |
Path to report output file |
Required |
./output/report.csv , stats-report.txt |
--append |
Whether to append to the output file instead of overwriting it |
false |
N/a |
--splitByDir |
Whether to parse each top-level directory separately |
false |
N/a |
--threads |
The number of concurrent threads to use for parsing (only when splitting by directory) |
4 |
2 , 8 |
--logLevel / -l |
The minimum severity of log message that should be displayed |
info |
debug , info , warn , error |
--timer |
Whether to print the total execution time of the specified task |
false |
N/a |
To access the help menu and see all available options, run:
./go-test-parser --help
Commands
Statistics
The statistics
command analyzes the Go test files in the specified project directory and generates various statistics related to the project's test cases. This includes metrics such as the total number of test cases, number of test files, average test length,
and the percentage of the project comprised of test code (by lines).
Supports output to either .txt
or .csv
files. Output is especially well-suited for a .csv
file if using the splitByDir
option.
Example:
./go-test-parser statistics --project ./my-go-project --output ./output/statistics-report.csv
Analyze
The analyze
command performs a deeper analysis of the test cases in a project. This command identifies various structural elements in each test, with a focus on table-driven test indicators. The results of analyzing the tests are saved in their own JSON files, which are put in a new folder in the same directory as the output
file. The JSON files are named like <project>/<project>_<package>_<testcase>.json
.
Supports output to either .txt
or .csv
files. Output is especially well-suited for a .csv
file because it will contain a condensed version of the analysis results of every test case.
Example:
./go-test-parser analyze --project ./my-go-project --output ./output/analyze-report.csv
Contributing
Contributions are welcome! Please feel free to submit Issues or Pull Requests!
License
This project is licensed under the MIT License. See the LICENSE file for details.