Documentation
¶
Index ¶
- func FormatAllInFolder(path string) error
- func NewDefaultFileResolver() *fr.DefaultFileResolver
- func ParseScenariosScenario(parser scenjparse.Parser, scenFilePath string) (*scenmodel.Scenario, error)
- func ParseScenariosScenarioDefaultParser(scenFilePath string) (*scenmodel.Scenario, error)
- func WriteScenariosScenario(scenario *scenmodel.Scenario, toPath string) error
- type RunScenarioOptions
- type ScenarioController
- type ScenarioRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAllInFolder ¶
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 ¶
func ParseScenariosScenario(parser scenjparse.Parser, scenFilePath string) (*scenmodel.Scenario, error)
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 ¶
type RunScenarioOptions struct {
ForceTraceGas bool
}
RunScenarioOptions defines the scenario options component
func DefaultRunScenarioOptions ¶
func DefaultRunScenarioOptions() *RunScenarioOptions
DefaultRunScenarioOptions creates a new RunScenarioOptions instance
type ScenarioController ¶
type ScenarioController struct {
Executor ScenarioRunner
RunsNewTest bool
Parser scenjparse.Parser
}
ScenarioController is a component that can run json scenarios, using a provided executor.
func NewScenarioController ¶
func NewScenarioController(executor ScenarioRunner, fileResolver fr.FileResolver) *ScenarioController
NewScenarioController creates new ScenarioController instance.
func (*ScenarioController) RunAllJSONScenariosInDirectory ¶
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 ¶
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(*scenmodel.Scenario, fr.FileResolver) error
}
ScenarioRunner describes a component that can run a VM scenario.