Documentation
¶
Index ¶
- func NewDefaultFileResolver() *fr.DefaultFileResolver
- func ParseScenariosScenario(parser mjparse.Parser, scenFilePath string) (*mj.Scenario, error)
- func ParseScenariosScenarioDefaultParser(scenFilePath string) (*mj.Scenario, error)
- func WriteScenariosScenario(scenario *mj.Scenario, toPath string) error
- type RunScenarioOptions
- type ScenarioController
- type ScenarioRunner
- type TestExecutor
- type TestRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultFileResolver ¶
func NewDefaultFileResolver() *fr.DefaultFileResolver
NewDefaultFileResolver yields a new DefaultFileResolver instance. Reexported here to avoid having all external packages importing the parser. DefaultFileResolver is in parse for local tests only.
func ParseScenariosScenario ¶
ParseScenariosScenario reads and parses a Scenarios scenario from a JSON file.
func ParseScenariosScenarioDefaultParser ¶
ParseScenariosScenarioDefaultParser reads and parses a Scenarios scenario from a JSON file.
Types ¶
type RunScenarioOptions ¶
RunScenarioOptions defines the scenario options component
func DefaultRunScenarioOptions ¶
func DefaultRunScenarioOptions() *RunScenarioOptions
DefaultRunScenarioOptions creates a new RunScenarioOptions instance
type ScenarioController ¶ added in v1.1.0
type ScenarioController struct {
Executor ScenarioRunner
RunsNewTest bool
Parser mjparse.Parser
}
ScenarioController is a component that can run json scenarios, using a provided executor.
func NewScenarioController ¶ added in v1.1.0
func NewScenarioController(executor ScenarioRunner, fileResolver fr.FileResolver) *ScenarioController
NewScenarioController creates new ScenarioController instance.
func (*ScenarioController) RunAllJSONScenariosInDirectory ¶ added in v1.1.0
func (r *ScenarioController) RunAllJSONScenariosInDirectory( generalTestPath string, specificTestPath string, allowedSuffix string, excludedFilePatterns []string, options *RunScenarioOptions) error
RunAllJSONScenariosInDirectory walks directory, parses and prepares all json scenarios, then calls ScenarioRunner for each of them.
func (*ScenarioController) RunSingleJSONScenario ¶ added in v1.1.0
func (r *ScenarioController) RunSingleJSONScenario(contextPath string, options *RunScenarioOptions) error
RunSingleJSONScenario parses and prepares test, then calls testCallback.
type ScenarioRunner ¶
type ScenarioRunner interface {
// Reset clears state/world.
Reset()
// RunScenario executes the scenario and checks if it passed. Failure is signaled by returning an error.
// The FileResolver helps with resolving external steps.
// TODO: group into a "execution context" param.
RunScenario(*mj.Scenario, fr.FileResolver) error
}
ScenarioRunner describes a component that can run a VM scenario.
type TestExecutor ¶
type TestExecutor interface {
// ExecuteTest executes the test and checks if it passed. Failure is signaled by returning an error.
ExecuteTest(*mj.Test) error
}
TestExecutor describes a component that can run a VM test.
type TestRunner ¶
type TestRunner struct {
Executor TestExecutor
Parser mjparse.Parser
}
TestRunner is a component that can run tests, using a provided executor.
func NewTestRunner ¶
func NewTestRunner(executor TestExecutor, fileResolver fr.FileResolver) *TestRunner
NewTestRunner creates new TestRunner instance.
func (*TestRunner) RunAllJSONTestsInDirectory ¶
func (r *TestRunner) RunAllJSONTestsInDirectory( generalTestPath string, specificTestPath string, allowedSuffix string, excludedFilePatterns []string) error
RunAllJSONTestsInDirectory walks directory, parses and prepares all json tests, then calls testExecutor for each of them.
func (*TestRunner) RunSingleJSONTest ¶
func (r *TestRunner) RunSingleJSONTest(contextPath string) error
RunSingleJSONTest parses and prepares test, then calls testCallback.