Skip to content

reporter: enrich tests with filenames #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

joergmis
Copy link
Contributor

@joergmis joergmis commented Mar 2, 2025

Search the directory for tests and try to enrich the report with the optional filepath property.

For it to work, it expects two things:

  • test function names have the prefix 'Test'
  • test files have '_test.go' suffix

The motivation behind this is to be able to generate reports which link tests and requirements together with for example strictdoc (which needs the path to the files).

The solution is anything but pretty. But as far as I have seen, there is no way to get the filenames from go test. With this, it is at least contained in the same tool (as opposed to creating a separate tool which adds the filepath property to the report).

This is also somewhat related to #10 since it could be extended to also get the line numbers - although a simple regex would not suffice for that.

Search the directory for tests and try to enrich the report with the
additional filepath property.

For it to work, it expects two things:
- test function names have the prefix 'Test'
- test files have '_test.go' suffix

Signed-off-by: Mischa Jörg <mischa@ninetyfour.ch>
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13610459833

Details

  • 25 of 30 (83.33%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+20.2%) to 57.432%

Changes Missing Coverage Covered Lines Changed/Added Lines %
reporter/reporter.go 25 30 83.33%
Totals Coverage Status
Change from base Build 13358114354: 20.2%
Covered Lines: 170
Relevant Lines: 296

💛 - Coveralls

@Ma11hewThomas Ma11hewThomas merged commit 172ae16 into ctrf-io:main Mar 8, 2025
6 checks passed
@Ma11hewThomas
Copy link
Contributor

Great idea and implementation, released v0.0.9

thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants