Skip to content

Commit

Permalink
Set .suite property to the go package name
Browse files Browse the repository at this point in the history
fixes #4
  • Loading branch information
asherf committed Sep 8, 2024
1 parent c886029 commit 455a673
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ The test object in the report includes the following [CTRF properties](https://c

| Name | Type | Required | Details |
| ---------- | ------ | -------- | ----------------------------------------------------------------------------------- |
| `suite` | String | Required | The name of go package containing the test. |
| `name` | String | Required | The name of the test. |
| `status` | String | Required | The outcome of the test. One of: `passed`, `failed`, `skipped`, `pending`, `other`. |
| `duration` | Number | Required | The time taken for the test execution, in milliseconds. |
Expand Down
3 changes: 3 additions & 0 deletions reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func ParseTestResults(r io.Reader, verbose bool, env *ctrf.Environment) (*ctrf.R
report.Results.Summary.Tests++
report.Results.Summary.Passed++
report.Results.Tests = append(report.Results.Tests, &ctrf.TestResult{
Suite: event.Package,
Name: event.Test,
Status: ctrf.TestPassed,
Duration: secondsToMillis(event.Elapsed),
Expand All @@ -55,6 +56,7 @@ func ParseTestResults(r io.Reader, verbose bool, env *ctrf.Environment) (*ctrf.R
report.Results.Summary.Tests++
report.Results.Summary.Failed++
report.Results.Tests = append(report.Results.Tests, &ctrf.TestResult{
Suite: event.Package,
Name: event.Test,
Status: ctrf.TestFailed,
Duration: secondsToMillis(event.Elapsed),
Expand All @@ -63,6 +65,7 @@ func ParseTestResults(r io.Reader, verbose bool, env *ctrf.Environment) (*ctrf.R
report.Results.Summary.Tests++
report.Results.Summary.Skipped++
report.Results.Tests = append(report.Results.Tests, &ctrf.TestResult{
Suite: event.Package,
Name: event.Test,
Status: ctrf.TestSkipped,
Duration: secondsToMillis(event.Elapsed),
Expand Down

0 comments on commit 455a673

Please sign in to comment.