Commit Graph

335 Commits

Author SHA1 Message Date
9c64855bf7 Fix regular expression for summary with "no statements" coverage.
Move the status message to the end of the regular expression.
2022-09-22 19:46:38 +00:00
7b10b42854 Merge pull request #141 from jstemmer/refactor-report-builder
Refactor report builder to support interleaved events from different packages
2022-08-23 23:04:51 +01:00
c796dcf8d1 junit: Remove unused indent parameter from formatOutput function 2022-08-23 23:04:15 +01:00
917d9f7023 Merge pull request #143 from greg-dennis/master
Report stores a slice of Property structs instead of a map
2022-08-23 23:03:23 +01:00
bf9aa098bb Fix SetProperty and add unit test. 2022-08-23 13:53:51 -04:00
15d215e49d Report stores a slice of Property structs rather than a map, to mimic JUnit properties, which have a deterministic ordering and allow multipler properties with the same name. 2022-08-23 10:41:42 -04:00
35c4d8a827 Merge pull request #142 from greg-dennis/patch-1
go-junit-report_test should fail if no files found
2022-08-19 21:31:31 +01:00
39473dc54e go-junit-report_test should fail if no files found
Today, if the testdata directory isn't present, this test trivially passes. This makes it fail when no files are found.
2022-08-19 10:55:25 -04:00
4d0ed8b681 Add testdata for go test -json -race tests.
Refs #134
2022-08-15 22:35:27 +01:00
9357c180d4 parser/gotest: Add support for processing events for different packages
The reportBuilder assumed we were always processing events for a single
package at a time. This is not true however when running `go test -json
-race` for example. In order to properly support processing events from
different packages we now have packageBuilders per package name.

Fixes #134
2022-08-15 22:35:27 +01:00
85f2715ac9 parser/gotest: Create JSONEventReader in internal reader package
The JSONEventReader implements reading lines with metadata and replaces
the gotest.jsonReader struct.
2022-08-15 22:07:52 +01:00
bd21d54501 parser/gotest: Add Package to Event
This allows each event to belong to a package, if we know it in advance.
2022-08-15 22:07:52 +01:00
f6f9df42b9 parser/gotest: Create interface for reading lines with metadata 2022-08-15 22:07:52 +01:00
27ad87e370 parser/gotest: parseLine now returns the events it creates 2022-08-15 22:07:52 +01:00
2af321a697 parser/gotest: Refactor benchmark grouping
The only reason groupBenchmarksByName needed the reportBuilder receiver
was to access its output collector. By passing the output explicitly to
the groupBenchmarksByName function we can remove the reportBuilder
dependency.
2022-08-15 22:05:38 +01:00
b73e4a9ed5 parser/gotest: Remove unnecessary if statement when creating a package
We only execute this branch when we've captured some global output, so
no need to check that again.
2022-08-13 22:06:49 +01:00
4ce910564c parser/gotest: timestampFunc should always be set, skip nil check 2022-08-13 21:59:50 +01:00
1c826cb28d parser/gotest: Switch to output collector for active id tracking 2022-08-13 20:50:39 +01:00
83ca558534 parser/gotest: Return created id from CreateTest method 2022-08-13 20:50:39 +01:00
50c1179050 parser/gotest: Remove benchmark specific methods from reportBuilder 2022-08-13 20:50:39 +01:00
9d434fa4b4 parser/gotest: Implement active id tracking in output collector 2022-08-13 20:50:39 +01:00
d6bf22343d parser/gotest: Move event processing into reportBuilder 2022-08-13 20:48:36 +01:00
0fc43a220a internal/gojunitreport: Refactor testFileConfig to drop else block 2022-08-13 20:48:36 +01:00
ddf6b16828 Replace += 1 with ++ 2022-08-13 20:48:31 +01:00
fbfb33add1 junit: Use consistent receiver name 2022-08-13 20:47:42 +01:00
5616b5e921 Add missing godoc on exported types 2022-08-11 00:47:46 +01:00
066da07a49 Add go1.19 and remove go1.17 from workflow 2022-08-03 23:43:25 +01:00
d75fb6d4c3 parser/gotest: Remove unused runErrors field from reportBuilder 2022-07-20 14:29:24 +01:00
01f2cdde22 parser/gotest: Use the new LimitedLineReader in the gotest parser 2022-07-18 23:02:22 +01:00
3e3223a05b parser/gotest: Create LimitedLineReader 2022-07-18 22:38:36 +01:00
80a51f2ed0 parser/gotest: Move const declaration to top of file 2022-07-18 22:37:49 +01:00
3d712f2417 junit: Don't include File attribute when it's empty 2022-07-07 00:19:59 +01:00
03010d4a32 junit: Add File attribute to testsuite
Closes #113
2022-07-07 00:18:30 +01:00
88ec9224c5 Fix broken pkg.go.dev links in README 2022-07-02 22:00:11 +01:00
fca6708da0 Add v2.0.0 changelog to README 2022-07-02 14:21:31 +01:00
dfab75c90e Update install from source instructions in README
Refs #136
2022-07-01 23:16:44 +01:00
7fde4641ac Use ioutil package for compatibility with Go 1.13
We specify 1.13 in go.mod, so we should make sure it can be built and
tested on that version. Let's keep using the ioutil package for now,
since it was only deprecated from 1.16.
v2.0.0
2022-07-01 22:53:57 +01:00
19190fdfd3 Add min supported and two most recent Go versions to workflow 2022-07-01 22:47:55 +01:00
63e0c8be15 junit: Improve test coverage of junit.CreateFromReport 2022-06-26 14:55:54 +01:00
f643780c47 parser/gotest: Add tests for internal package collector 2022-06-26 14:23:58 +01:00
079e5ce7ea parser/gotest: Add support for parsing lines longer than 64K
The gotest parser used a bufio.Scanner to read its input, which
prevented us from reading lines larger than 64K.

In order to support reading larger lines, bufio.Scanner has been
replaced with bufio.Reader. The maximum line size has been increased to
4MiB and instead of returning an error when reading lines that exceed
the maximum size, we truncate that line and continue parsing.

Fixes #135
2022-06-26 00:45:06 +01:00
7875e13422 parser/gotest: Move NewParser function below Parser struct 2022-06-26 00:43:55 +01:00
8648745762 parser/gotest: Don't ignore output when there were no tests
In some cases we may have captured some output for a package that didn't
have any tests. We should include it in the generated report as it may
contain useful information.
2022-06-26 00:43:05 +01:00
d84b41a3f9 Update gitub.com/google/go-cmp dependency to v0.5.8 2022-06-15 23:46:40 +01:00
da6551b8c0 gtr,parser/gotest: Remove gtr.Benchmark and use gtr.Test for all tests 2022-06-15 23:46:40 +01:00
dc591b8731 junit: Remove benchmark specific code from package junit
The junit package shouldn't need to know anything about benchmarks and
gtr.Benchmark will be removed in a future commit. Instead, it will be
the responsibility of the gotest parser to represent benchmarks using
gtr.Test.
2022-06-15 23:46:40 +01:00
46e0aed494 gtr: Also look at failures in benchmarks when creating a package
When we encounter a failure but there was not failing test, we create a
failing dummy test in the report. This is to prevent the failure from
being overlooked.

The case where the output contained a failing benchmark was not handled
correctly, resulting in a dummy test failure being added to the report
unnecessarily.
2022-06-13 00:47:28 +01:00
d05abd4130 junit: Include output in JUnit report for skipped and failed benchmarks 2022-06-13 00:34:20 +01:00
f1ad02b733 junit: Use the standard duration formatting for benchmark durations
Benchmark durations were originally formatted with higher precision
because they contained just the NsPerOp field. Now that we're
approximating the total duration they are more accurate and don't need
as many decimals.
2022-06-12 23:02:01 +01:00
1d905e0b1c gtr: Improve accuracy of benchmark duration calculation
The NsPerOp was previously casted to a time.Duration (int64) before
multiplying it with the number of iterations. This has been fixed by
doing the casting after the multiplication. The resulting duration
should be a bit more accurate.
2022-06-12 22:56:04 +01:00