You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer, I want to run automated validation tests on any new or amended integrations test, so that I can be confident that the test is no flaky.
See the Tests Policy.
As a developer, I need a way discriminate between integration tests and non-integration tests, so that I can I don't run automated tests unnecessarily.
Proposal:
Labels
Create a set of test labels. eg:
e2e
integration
unit
network
Usage
Prepend the test function name with the tag(s), and execute tests with -run <LABEL>
See examples below:
Command:
go test -run Integration
go test -run Unit
Identify test as integration, will run with integration tests and all tests.
funcTestIntegrationMessengerSomeThing(t*testing.T) {
// The body of the test
}
Identify test as integration, will ONLY run with integration test commands
funcTestIntegrationMessengerIntOnly(t*testing.T) {
ifm:=flag.Lookup("test.run").Value.String(); m==""||!regexp.MustCompile(m).MatchString(t.Name()) {
t.Skip("skipping as execution was not requested explicitly using go test -run")
}
// The body of the test
}
Identify test as unit and network, will run with unit or network, and all tests.
funcTestUnitNetworkMessengerSomeOtherThing(t*testing.T) {
// The body of the test
}
Problem:
Proposal:
Labels
Create a set of test labels. eg:
e2e
integration
unit
network
Usage
Prepend the test function name with the tag(s), and execute tests with
-run <LABEL>
See examples below:
Command:
go test -run Integration
go test -run Unit
Identify test as
integration
, will run withintegration
tests andall
tests.Identify test as
integration
, will ONLY run withintegration
test commandsIdentify test as
unit
andnetwork
, will run withunit
ornetwork
, andall
tests.Reference
Docs : https://pkg.go.dev/testing#hdr-Subtests_and_Sub_benchmarks
Following from : #4908 (comment)
The text was updated successfully, but these errors were encountered: