43 Commits

Author SHA1 Message Date
Joël Stemmer
0b843fc2b7 gtr,parser/gotest: Move ReportBuilder to gotest package
The ReportBuilder was made specifically for building a gtr.Report from
parsed go test output. At this point it's unclear whether this will be
reusable if we ever introduce other parser. For now let's move it closer
to where it's used and let's not make it part of the public API yet.
2022-03-27 23:55:59 +01:00
Joël Stemmer
3190f85fe3 gtr: Add Timestamp field to Package
When using the ReportBuilder, the Timestamp will by default be set to
the current local time.
2022-03-22 22:05:23 +00:00
Joël Stemmer
c78e04707f gtr,parser/gotest: move Event and building a report to parser/gotest
The Parse method now directly returns a report, rather than a list of
events that then need to be converted into a report. As part of this
change, the Event struct has also been moved to the gotest package. It's
now the responsibility of the parser to construct a gtr.Report.
2022-03-22 22:05:23 +00:00
Joël Stemmer
0e7d095a28 gtr: add documentation to exported types and methods 2022-03-22 22:05:23 +00:00
Joël Stemmer
5e492f8212 gtr: rename Package.AddProperty to Package.SetProperty
Properties are stored in a map, so SetProperty better reflects its
behaviour.
2022-03-22 22:05:23 +00:00
Joël Stemmer
10affc0da1 Store arbitrary key/value properties in Report 2022-03-22 22:05:23 +00:00
Joël Stemmer
9aa9bd94d8 gtr: Remove unnecessary TODO
There's no need (yet) to check if output is potentially a build error,
as build errors are currently handled separately by the parser/gotest
package.
2022-03-22 22:05:23 +00:00
Joël Stemmer
a77bfe0f1c gtr,junit: move creation of JUnit testsuites from gtr to junit
Package gtr shouldn't need to know about the existence of different
output formats like junit.
2022-03-22 22:05:23 +00:00
Joël Stemmer
334044509c Remove custom properties parsed from test output
In the future it will be possible to add your own properties via
commandline flags.
2022-03-22 22:05:23 +00:00
Joël Stemmer
43c784a63b Set non-zero exit code for build/run errors when using -set-exit-code 2022-03-20 22:35:50 +00:00
Joël Stemmer
c8de8e11aa gtr: Remove unused findBenchmark function 2022-03-20 22:35:50 +00:00
Joël Stemmer
016e21634a gtr: Add documentation to ReportBuilder 2022-03-20 22:35:50 +00:00
Joël Stemmer
bab26d76b5 gtr: Write test output to JUnit SystemOut
Fixes #108
2022-03-20 22:35:50 +00:00
Joël Stemmer
7d75448298 gtr: Remove debug print 2022-03-20 22:35:50 +00:00
Joël Stemmer
817a23b10d gtr: Handle end_test events without corresponding run_test event
When running `go test` without the `-v` flag, the output may not contain
everything that we expect. For example, no output is generated for
passing tests. Even for a failing test the output does not contain a
`=== RUN` line.

Currently, this resulted in us ignoring the test result since we
couldn't find an existing test to assign this result to. We should
however handle this situation gracefully, and just assume a test exists
when only encountering a test result line.

References #109
2022-03-20 22:35:50 +00:00
Joël Stemmer
2ece8eae1a gtr: Set hostname and timestamp fields when creating JUnit Testsuite
Fixes #117
2022-03-20 22:35:50 +00:00
Joël Stemmer
cb7f773314 gtr: Add build error test case 2022-03-20 22:35:50 +00:00
Joël Stemmer
80a9b62b38 gtr: Fix prefix trimming of test output 2022-03-20 22:35:50 +00:00
Joël Stemmer
506a968ade gtr: Handle failed summary when no tests failed 2022-03-20 22:35:50 +00:00
Joël Stemmer
4fdb6ca564 gtr: Move tests from build and runtime errors to end of junit report 2022-03-20 22:35:50 +00:00
Joël Stemmer
5007397e33 gtr: Reset active test when encountering a status line
This is to ensure that we don't append output lines that follow after a
status line to the last active test.
2022-03-20 22:35:50 +00:00
Joël Stemmer
f7ae0905a2 gtr: Add support for pause/continue tests 2022-03-20 22:35:50 +00:00
Joël Stemmer
c845dfac27 gtr: Correctly handle packages without tests 2022-03-20 22:35:50 +00:00
Joël Stemmer
9167a5d41d gtr: Add support for runtime/init errors 2022-03-20 22:35:50 +00:00
Joël Stemmer
ffc33941fa gtr, parser/gotest: Add support for build errors 2022-03-20 22:35:50 +00:00
Joël Stemmer
b1b88456c1 gtr: Refactor ReportBuilder flush 2022-03-20 22:35:50 +00:00
Joël Stemmer
52a5393fd3 gtr: Refactor ReportBuilder 2022-03-20 22:35:50 +00:00
Joël Stemmer
3f9d5b62db gtr, parser/gotest: Move output formatting out of parser 2022-03-20 22:35:50 +00:00
Joël Stemmer
1563e51b7c gtr: Fix testsuite duration 2022-03-20 22:35:50 +00:00
Joël Stemmer
d2d65ebe03 gtr: Fix skipped test output 2022-03-20 22:35:50 +00:00
Joël Stemmer
824b607642 gtr: Handle coverage events 2022-03-20 22:35:50 +00:00
Joël Stemmer
77ad1709cf gtr: Add default package name to report 2022-03-20 22:35:50 +00:00
Joël Stemmer
5f2324f6d4 gtr: Fix junit testsuites test count 2022-03-20 22:35:50 +00:00
Joël Stemmer
a100cfaa5f gtr: Add benchmarks to Report 2022-03-20 22:35:50 +00:00
Joël Stemmer
4f6df9492b gtr, parser/gotest: Add test 130 2022-03-20 22:35:50 +00:00
Joël Stemmer
1a0c32347c gtr,parser/gotest: Add test 27 2022-03-20 22:35:50 +00:00
Joël Stemmer
c03c92d418 gtr,parser/gotest: Improve benchmark output matching 2022-03-20 22:35:50 +00:00
Joël Stemmer
a52c1b921d gtr: Fix naming of Result constants 2022-03-20 22:35:50 +00:00
Joël Stemmer
ff2fc90eeb parser/gotest,gtr: Move Event type to package gtr 2022-03-20 22:35:50 +00:00
Joël Stemmer
7bc0f1a86b gtr: Extract report builder to separate file 2022-03-11 21:53:02 +00:00
Joël Stemmer
41b1555d82 gtr: Add skipped test 2022-03-07 00:09:34 +00:00
Joël Stemmer
bdaa9a9626 gtr: Append output to tests 2022-03-07 00:09:34 +00:00
Joël Stemmer
cc15e48982 gtr: Create package gtr 2022-03-07 00:09:34 +00:00