{"id":20137088,"url":"https://github.com/ctrf-io/go-ctrf-json-reporter","last_synced_at":"2026-05-02T13:05:06.369Z","repository":{"id":220577625,"uuid":"751990585","full_name":"ctrf-io/go-ctrf-json-reporter","owner":"ctrf-io","description":"A Go JSON test results reporter that follows the CTRF schema","archived":false,"fork":false,"pushed_at":"2025-11-23T17:19:17.000Z","size":44,"stargazers_count":20,"open_issues_count":3,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-23T19:12:19.056Z","etag":null,"topics":["go-reporter","golang","gotest","test-automation","test-reporting"],"latest_commit_sha":null,"homepage":"https://ctrf.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ctrf-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-02T19:16:08.000Z","updated_at":"2025-11-23T17:16:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"54fdebde-e76c-410f-a8f2-f71c4c4da8ab","html_url":"https://github.com/ctrf-io/go-ctrf-json-reporter","commit_stats":null,"previous_names":["ctrf-io/go-ctrf-json-reporter"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/ctrf-io/go-ctrf-json-reporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrf-io%2Fgo-ctrf-json-reporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrf-io%2Fgo-ctrf-json-reporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrf-io%2Fgo-ctrf-json-reporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrf-io%2Fgo-ctrf-json-reporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctrf-io","download_url":"https://codeload.github.com/ctrf-io/go-ctrf-json-reporter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctrf-io%2Fgo-ctrf-json-reporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32534975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T12:25:33.646Z","status":"ssl_error","status_checked_at":"2026-05-02T12:24:51.733Z","response_time":132,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go-reporter","golang","gotest","test-automation","test-reporting"],"created_at":"2024-11-13T21:25:09.066Z","updated_at":"2026-05-02T13:05:06.334Z","avatar_url":"https://github.com/ctrf-io.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go CTRF JSON format support\n\n## Go JSON Reporter\n\nA Go JSON test reporter to create test reports that follow the CTRF standard.\n\n[Common Test Report Format](https://ctrf.io) ensures the generation of uniform JSON test reports, independent of programming languages or test framework in use.\n\n\u003cdiv align=\"center\"\u003e\n\u003cdiv style=\"padding: 1.5rem; border-radius: 8px; margin: 1rem 0; border: 1px solid #30363d;\"\u003e\n\u003cspan style=\"font-size: 23px;\"\u003e💚\u003c/span\u003e\n\u003ch3 style=\"margin: 1rem 0;\"\u003eCTRF tooling is open source and free to use\u003c/h3\u003e\n\u003cp style=\"font-size: 16px;\"\u003eYou can support the project with a follow and a star\u003c/p\u003e\n\n\u003cdiv style=\"margin-top: 1.5rem;\"\u003e\n\u003ca href=\"https://github.com/ctrf-io/go-ctrf-json-reporter\"\u003e\n\u003cimg src=\"https://img.shields.io/github/stars/ctrf-io/go-ctrf-json-reporter?style=for-the-badge\u0026color=2ea043\" alt=\"GitHub stars\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/ctrf-io\"\u003e\n\u003cimg src=\"https://img.shields.io/github/followers/ctrf-io?style=for-the-badge\u0026color=2ea043\" alt=\"GitHub followers\"\u003e\n\u003c/a\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cp style=\"font-size: 14px; margin: 1rem 0;\"\u003e\nMaintained by \u003ca href=\"https://github.com/ma11hewthomas\"\u003eMatthew Thomas\u003c/a\u003e\u003cbr/\u003e\nContributions are very welcome! \u003cbr/\u003e\nExplore more \u003ca href=\"https://www.ctrf.io/integrations\"\u003eintegrations\u003c/a\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\n## Features\n\n- Generate JSON test reports that are [CTRF](https://ctrf.io) compliant\n- Straightforward integration with Go\n\n```json\n{\n  \"results\": {\n    \"tool\": {\n      \"name\": \"gotest\"\n    },\n    \"summary\": {\n      \"tests\": 1,\n      \"passed\": 1,\n      \"failed\": 0,\n      \"pending\": 0,\n      \"skipped\": 0,\n      \"other\": 0,\n      \"start\": 1706828654274,\n      \"stop\": 1706828655782\n    },\n    \"tests\": [\n      {\n        \"name\": \"ctrf should generate the same report with any tool\",\n        \"status\": \"passed\",\n        \"duration\": 100\n      }\n    ],\n    \"environment\": {\n      \"appName\": \"MyApp\",\n      \"buildName\": \"MyBuild\",\n      \"buildNumber\": \"1\"\n    }\n  }\n}\n```\n\n## Installation\n\nTo install go-ctrf-json-reporter, ensure you have Go installed on your system, then run:\n\n``` bash\ngo install github.com/ctrf-io/go-ctrf-json-reporter/cmd/go-ctrf-json-reporter@latest\n```\n\nThis command will install the latest version of go-ctrf-json-reporter.\n\nAfter installation, you can use go-ctrf-json-reporter by piping the output of go test -json into it:\n\n``` bash\ngo test -json ./... | go-ctrf-json-reporter -output ctrf-report.json\n```\n\n## Reporter Options\n\n``` bash\ngo test -json ./... | go-ctrf-json-reporter \\\n-output custom-name.json \\\n-verbose \\\n-quiet \\\n-appName \"MyApp\" \\\n-appVersion \"1.0.0\" \\\n-osPlatform \"Linux\" \\\n-osRelease \"18.04\" \\\n-osVersion \"5.4.0\" \\\n-buildName \"MyAppBuild\" \\\n-buildNumber \"100\"\n```\n\n## Integration with gotestsum\n\ngo-ctrf-json-reporter can be used in conjunction with gotestsum\n\n``` bash\ngotestsum --jsonfile gotestsum.json \u0026\u0026 go-ctrf-json-reporter \u003c gotestsum.json\n```\n\n## Generate a CTRF JSON report in your own testing tool written in go\n\nIf you are writting your own testing tool and wish to generate a CTRF JSON report, you can use the `ctrf` package.\n\n```go\nimport (\n  \"github.com/ctrf-io/go-ctrf-json-reporter/ctrf\"\n)\n\nfunc runTests(destinationReportFile string) error {\n  env := ctrf.Environment{\n    // add your environment details here\n  }\t\n  report := ctrf.NewReport(\"my-awesome-testing-tool\", \u0026env)\n    \n  // run your tests and populate the report object here\n\n  return report.WriteFile(destinationReportFile)\n}\n\n```\n\n## Test Object Properties\n\nThe test object in the report includes the following [CTRF properties](https://ctrf.io/docs/schema/test):\n\n| Name       | Type   | Required | Details                                                                             |\n| ---------- | ------ | -------- | ----------------------------------------------------------------------------------- |\n| `name`     | String | Required | The name of the test.                                                               |\n| `status`   | String | Required | The outcome of the test. One of: `passed`, `failed`, `skipped`, `pending`, `other`. |\n| `duration` | Number | Required | The time taken for the test execution, in milliseconds.                             |\n| `message`  | String | Optional | The failure message if the test failed.                                             |\n| `suite`    | String | Required | The name of go package containing the test.                                         |\n\n## Troubleshoot\n\n### Command Not Found\n\nWhen running go-ctrf-json-reporter results in a \"command not found\" error this usually means that the Go bin directory is not in your system's PATH.\n\n## Development\n\nContributions are welcome! See [Contributing](CONTRIBUTING.md) for more information.\n\n### Build the binary\n\n```bash\ngo build -o go-ctrf-json-reporter ./cmd/go-ctrf-json-reporter\n```\n\n### Running Tests\n\n```bash\ngo test ./...\n```\n\n### Testing the Reporter\n\n```bash\ngo test -json ./... | ./go-ctrf-json-reporter -output ctrf-report.json\n\ncat ctrf-report.json\n```\n\n### Development Workflow\n\n1. Make changes to the code\n2. Run tests: `go test ./...`\n3. Test the reporter: `go test -json ./... | ./go-ctrf-json-reporter -output test-results.json`\n4. Check the generated CTRF report: `cat test-results.json`\n\n### Troubleshooting\n\nIf you encounter issues with test execution, ensure your Go environment is set correctly for your platform:\n\n```bash\n# Check your Go environment\ngo env GOOS GOARCH\n\n# Set for your platform if needed\nexport GOOS=darwin GOARCH=arm64  # For macOS ARM64\nexport GOOS=linux GOARCH=amd64   # For Linux x86_64\nexport GOOS=windows GOARCH=amd64 # For Windows x86_64\n```\n\nMake sure the binary is executable:\n\n```bash\nchmod +x go-ctrf-json-reporter\n```\n\n## What is CTRF?\n\nCTRF is a universal JSON test report schema that addresses the lack of a standardized format for JSON test reports.\n\n**Consistency Across Tools:** Different testing tools and frameworks often produce reports in varied formats. CTRF ensures a uniform structure, making it easier to understand and compare reports, regardless of the testing tool used.\n\n**Language and Framework Agnostic:** It provides a universal reporting schema that works seamlessly with any programming language and testing framework.\n\n**Facilitates Better Analysis:** With a standardized format, programatically analyzing test outcomes across multiple platforms becomes more straightforward.\n\n## Support Us\n\nIf you find this project useful, consider giving it a GitHub star ⭐ It means a lot to us.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrf-io%2Fgo-ctrf-json-reporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctrf-io%2Fgo-ctrf-json-reporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctrf-io%2Fgo-ctrf-json-reporter/lists"}