Documentation
¶
Index ¶
- func CompareOutputWithFixture(t *testing.T, testerOutput []byte, normalizeOutputFunc func([]byte) []byte, ...)
- func IsRecordingOrEvaluatingFixtures() bool
- func TestTesterOutput(t *testing.T, testerDefinition tester_definition.TesterDefinition, ...)
- func ValidateTesterDefinitionAgainstYAML(t testing.T, testerDefinition tester_definition.TesterDefinition, ...)
- type TesterOutputTestCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRecordingOrEvaluatingFixtures ¶
func IsRecordingOrEvaluatingFixtures() bool
IsRecordingOrEvaluatingFixtures can be used to run code required to control any external sources of randomness that can affect fixtures.
Use this sparingly, we don't want to introduce too much drift between our test environment and production.
Note: This is only needed to control *external* sources of randomness. Any random values generated by the tester should use tester_utils.random, which uses a fixed seed across all test runs.
func TestTesterOutput ¶
func TestTesterOutput(t *testing.T, testerDefinition tester_definition.TesterDefinition, testCases map[string]TesterOutputTestCase)
func ValidateTesterDefinitionAgainstYAML ¶
func ValidateTesterDefinitionAgainstYAML(t testing.T, testerDefinition tester_definition.TesterDefinition, yamlPath string)
ValidateTesterDefinitionAgainstYAML tests whether the stage slugs in TesterDefintion match those in the course YAML at yamlPath.
Types ¶
type TesterOutputTestCase ¶
type TesterOutputTestCase struct {
// CodePath is the path to the code that'll be tested.
CodePath string
// ExpectedExitCode is the exit code that we expect the tester to return.
ExpectedExitCode int
// UntilStageSlug is the slug of the stage that we want to test until. Either this or StageSlug must be provided.
UntilStageSlug string
// SkipAntiCheat is a flag that indicates whether we want to skip the anti-cheat check.
SkipAntiCheat *bool
// StageSlugs is the list of stages that we want to test. Either this or UntilStageSlug must be provided.
StageSlugs []string
// StdoutFixturePath is the path to the fixture file that contains the expected stdout output.
StdoutFixturePath string
// NormalizeOutputFunc is a function that normalizes the tester's output. This is useful for removing things like timestamps.
NormalizeOutputFunc func([]byte) []byte
}
Click to show internal directories.
Click to hide internal directories.