Documentation ¶
Index ¶
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.
Types ¶
type ScenarioExecutor ¶
type ScenarioExecutor interface { // Reset clears state/world. Reset() // ExecuteScenario 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. ExecuteScenario(*mj.Scenario, fr.FileResolver) error }
ScenarioExecutor describes a component that can run a VM scenario.
type ScenarioRunner ¶
type ScenarioRunner struct { Executor ScenarioExecutor Parser mjparse.Parser }
ScenarioRunner is a component that can run json scenarios, using a provided executor.
func NewScenarioRunner ¶
func NewScenarioRunner(executor ScenarioExecutor, fileResolver fr.FileResolver) *ScenarioRunner
NewScenarioRunner creates new ScenarioRunner instance.
func (*ScenarioRunner) RunAllJSONScenariosInDirectory ¶
func (r *ScenarioRunner) RunAllJSONScenariosInDirectory( generalTestPath string, specificTestPath string, allowedSuffix string, excludedFilePatterns []string) error
RunAllJSONScenariosInDirectory walks directory, parses and prepares all json scenarios, then calls scenarioExecutor for each of them.
func (*ScenarioRunner) RunSingleJSONScenario ¶
func (r *ScenarioRunner) RunSingleJSONScenario(contextPath string) error
RunSingleJSONScenario parses and prepares test, then calls testCallback.
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.