For most testcases we shouldn't need to specify the input and report
files, instead just look at the testdata/ dir and process each input
file. For the few testcases that need a non-standard config, an entry
can be added to `testConfigs` map (indexed by the test number).
The testdata files must follow a certain naming pattern to be valid.
They should start with a number, followed by a dash, then any text
describing the test and finally end with `.txt`. The corresponding
report file must start with the same number, a dash, followed by
`report.xml`.
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.
Go doesn't omit empty parent tags for empty values[1], so we'll work
around this for now by creating a pointer to the property slice.
[1]: https://github.com/golang/go/issues/7233.
Sometimes, the text after "# " shows the name of the test binary
("<package>.test") in addition to the package
e.g.: "# package/name [package/name.test]".
This change ensures that the packages' build outputs are associated
correctly in this case.
Mainly:
* Moving the averaging/merging of benchmarks from the parser to the formatter package
* Tightening up the regex so it only captures the numeric values (no more of trimming spaces and the ns/op)
* Deleting the writing up in xml file the benchmark memory sections of B/op and Allocs/op
Also added a test case for parseNanoseconds().
Whenever we encounter a result line in the test output, we would find
the first test with the matching name and update it. However, in some
cases it's possible for the same test name to appear multiple times in
the output. To prevent us from always updating the oldest test, the
order in which findTests searches for a matching test is reversed so
that it always returns the most recently added test.
Fixes#54.
If a package compiles correctly, but panics before it has a chance to
run any tests it would previously be ignored. Any failing packages
without tests but with some output will now be included in the report
with a dummy test.
Fixes#52
Makes it so that the value of the "go.version" property in
the output XML can be customized by the caller using the
"go-version" flag. If the flag is unspecified, falls back to
the previous behavior of using runtime.Version() as the value.
Fixes#48