TestAnything / Specification

Working towards a new TAP specification
89 stars 8 forks source link

A test running addendum? #42

Open Leont opened 1 year ago

Leont commented 1 year ago

Currently we're only describing the TAP stream and nothing around it. I think it may be useful to also (probably separate from the main document?) to write something about running the programs that output TAP. In particular

ferdnyc commented 1 year ago

@Leont

  • Using an environmental variable to hint to the TAP producer what versions of TAP the consumer wants to consume (e.g. TAP_VERSIONS=14,13,12)

That sounds to me like an implementation detail and an unspecifiable requirement at the same time.

(Envvars are great in a CI environment or similar, but they suck if you're distributing tests with a public project. Now you have to try and find a way to ensure that everyone who runs the tests has the right variables set in their environment — which won't happen. Whereas, if you can check in a config file that the producer will automatically pick up, problem solved.)

For exit codes, the spec already says (In §Harness Behavior):

A harness should treat a test program as a failed test if:

  • The TAP output lines indicate test failure, or
  • The TAP output of the process is invalid in a way that is not recoverable, or
  • The exit code of the test program is not 0 (including test programs killed by a fatal Unix signal).

If one or more test programs are considered failures, then a TAP Harness should indicate failure to the user in whatever means are appropriate. For example, a command-line test runner might exit with a non-zero status code, while a web-based continuous integration system might put a red "FAILED" notice in the html output.

Which I think is appropriately vague, in the same "different approaches for different scenarios" way.