sampletests

command
v0.0.0-...-3b29460 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

The sampletests command adds the region tags tested by each test to the XML properties of that test case. It reads JUnit XML from stdin and writes JUnit XML to stdout.

For example, if TestFoo tests the regions foo_hello_world and foo_hello_gopher, the TestFoo element will have the following property:

<property name="region_tags" value="foo_hello_world,foo_hello_gopher"></property>

sampletests only looks at direct function calls or references by tests. So, if you have a map from string -> function reference in the global scope and test functions only reference the string, sampletests will not work.

There are some duplicate region tags, but they aren't tracked anywhere else, so it's OK if they are "applied" to more than one test.

sampletests only looks in the current module, which matches the behavior of `go test`. So, if you run `go test ./...` and sampletests in the same directory they should both find the same set of packages.

The test coverage over all regions is printed to stderr at the end. The coverage is based on the entire module, not just the tests that happen to be in the given XML input. The XML may not be for for all tests in the module.

Warnings are printed to stderr for invalid region tags (e.g. mis-matched START and END tags).

The -enable_xml flag can be used to disable XML processing and only print warnings and coverage.

To get the number of unique region tags in the repo manually, run:

grep -ERho '\[START .+' | sort -u | wc -l

Directories

Path Synopsis
Package hello is used only for testing.
Package hello is used only for testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL