TestResult InvokeTest(IMachine machine, string testKey, IDictionary <string, string> parameters) { ITestResultBin bin = provider.CreateBin(testKey); initFunc(machine); var testResult = func(machine, parameters, bin); provider.OnResult(testKey, testResult); return(testResult); }
public object Execute(string javascript, IDictionary <string, string> parameters) { Script script = null; // Compile script try { script = ctx.compileString(javascript, "Javascript Test Plan", 1, null); } catch (RhinoException ex) { throw new Exception("Compile error at line " + ex.lineNumber() + ": " + ex.details()); } try { var parmScope = ctx.newObject(scope); foreach (var parm in parameters) { parmScope.put(parm.Key, parmScope, parm.Value); } return(script.exec(ctx, parmScope)); } catch (RhinoException err) { provider.OnResult("Error", new TestResult() { Success = false, StandardError = err.getMessage() }); return(null); //throw new Exception("Runtime error: " + err.getMessage()); } }