/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The model to connect to</param> /// <param name="view">The view to connect to</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public override void Attach(object model, object view, ExplorerPresenter explorerPresenter) { base.Attach(model, view, explorerPresenter); grid.ContextItemsNeeded += GetContextItems; grid.CanGrow = false; this.model = model as Model; intellisense = new IntellisensePresenter(grid as ViewBase); // The grid does not have control-space intellisense (for now). intellisense.ItemSelected += OnIntellisenseItemSelected; // if the model is Testable, run the test method. ITestable testModel = model as ITestable; if (testModel != null) { testModel.Test(false, true); grid.ReadOnly = true; } grid.NumericFormat = "G6"; FindAllProperties(this.model); if (grid.DataSource == null) { PopulateGrid(this.model); } else { FormatTestGrid(); } grid.CellsChanged += OnCellValueChanged; grid.ButtonClick += OnFileBrowseClick; this.presenter.CommandHistory.ModelChanged += OnModelChanged; }
/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The model to connect to</param> /// <param name="view">The view to connect to</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.grid = view as IGridView; this.grid.ContextItemsNeeded += GetContextItems; this.model = model as Model; this.explorerPresenter = explorerPresenter; // if the model is Testable, run the test method. ITestable testModel = model as ITestable; if (testModel != null) { testModel.Test(false, true); this.grid.ReadOnly = true; } this.grid.NumericFormat = "G6"; grid.CanGrow = false; this.childrenWithSameType = this.GetChildModelsWithSameType(this.model); this.FindAllPropertiesForChildren(); if (this.grid.DataSource == null) { this.PopulateGrid(this.model); } else { this.FormatTestGrid(); } this.grid.CellsChanged += this.OnCellValueChanged; this.grid.ButtonClick += this.OnFileBrowseClick; this.explorerPresenter.CommandHistory.ModelChanged += this.OnModelChanged; }
/// <summary> /// Start a Test and throw exception in errorcase /// </summary> /// <param name="typeName">typename of testcase to load</param> /// <param name="testsystem">string with the testsystem</param> /// <param name="language">string with the language</param> /// <param name="browser"></param> internal void InitializeTest(string typeName, string testsystem, string language, Browser browser) { TestHeader = String.Format("Testcase: {0} ({1}, {2}) on {3}", typeName, language, browser, testsystem); _testable = _testcaseProvider.GetTestableFromTypeName(typeName); _testable.GetLogLastTime(); _testable.SetupTest(WebDriverInitStrategy.SeleniumLocal, browser, testsystem, language); try { _testable.Test(); } catch (TaskCanceledException) { //Test is canceled. Do normal teardown } _testable.TeardownTest(); }
/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The model to connect to</param> /// <param name="view">The view to connect to</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.grid = view as IGridView; this.grid.ContextItemsNeeded += GetContextItems; this.model = model as Model; this.explorerPresenter = explorerPresenter; this.intellisense = new IntellisensePresenter(grid as ViewBase); // The grid does not have control-space intellisense (for now). intellisense.ItemSelected += (sender, e) => grid.InsertText(e.ItemSelected); // if the model is Testable, run the test method. ITestable testModel = model as ITestable; if (testModel != null) { testModel.Test(false, true); this.grid.ReadOnly = true; } string[] split; this.grid.NumericFormat = "G6"; this.FindAllProperties(this.model); if (this.grid.DataSource == null) { this.PopulateGrid(this.model); } else { this.grid.ResizeControls(); this.FormatTestGrid(); } this.grid.CellsChanged += this.OnCellValueChanged; this.grid.ButtonClick += this.OnFileBrowseClick; this.explorerPresenter.CommandHistory.ModelChanged += this.OnModelChanged; if (model != null) { split = this.model.GetType().ToString().Split('.'); this.grid.ModelName = split[split.Length - 1]; this.grid.LoadImage(); } }
/// <summary> /// Attach the model to the view. /// </summary> /// <param name="model">The model to connect to</param> /// <param name="view">The view to connect to</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.grid = view as IGridView; this.model = model as Model; this.explorerPresenter = explorerPresenter; // if the model is Testable, run the test method. ITestable testModel = model as ITestable; if (testModel != null) { testModel.Test(false, true); this.grid.ReadOnly = true; } string[] split; grid.NumericFormat = "G6"; this.FindAllProperties(this.model); if (this.grid.DataSource == null) { this.PopulateGrid(this.model); } else { this.grid.ResizeControls(); FormatTestGrid(); } this.grid.CellsChanged += this.OnCellValueChanged; this.grid.ButtonClick += OnFileBrowseClick; this.explorerPresenter.CommandHistory.ModelChanged += this.OnModelChanged; if (model != null) { split = this.model.GetType().ToString().Split('.'); this.grid.ModelName = split[split.Length - 1]; this.grid.LoadImage(); } }
public void UseTester(ITestable tester) { tester.Test(); }
private TestResult HandleTest(WorkItem workItem) { TestResult testResult = new TestResult(); ITestable testable = null; List <string> log = new List <string>(); try { log.Add("Test on " + _nodename); /**1: Load Testclass **/ Console.WriteLine(@"Testing {0} {1} ({2}/{3})", workItem.Testcase.Name, workItem.Browser.Name, workItem.Testsystem.Name, workItem.Language.Languagecode); testable = LoadTestable(workItem); if (testable == null) { return new TestResult { TestState = TestState.NotAvailable } } ; /**2: Wait for branch get ready **/ WaitOnWebExceptions(workItem); /**3: Prepare Test **/ Browser browser = new Browser() { Browserstring = workItem.Browser.Browserstring, Versionsstring = workItem.Browser.Versionsstring }; testable.SetupTest(WebDriverInitStrategy.SeleniumLocal, browser, workItem.Testsystem.Url, workItem.Language.Languagecode); /**4: Run Test **/ testable.Test(); testResult.TestState = TestState.Success; } catch (NotSupportedException notSupportedException) { Error error = CreateErrorFromException(notSupportedException); testResult.TestState = TestState.NotSupported; testResult.Error = error; } catch (TaskCanceledException taskCanceledException) { Error error = CreateErrorFromException(taskCanceledException); testResult.TestState = TestState.Canceled; testResult.Error = error; } catch (Exception exception) { ServerErrorModel serverException = null; try { if (testable != null) { serverException = testable.CheckForServerError(); } } catch { //Error catching serverException } Error error = CreateErrorFromException(exception); if (serverException != null) { error.Type = serverException.Type; error.Message = serverException.Message; error.InnerException = serverException.InnerException; //objError.StackTrace = serverException.StackTrace; Keep error stacktrace. } testResult.TestState = TestState.Error; testResult.Error = error; if (testable != null) { testResult.Screenshot = testable.SaveScreenshot(""); } } finally { if (testable != null) { testable.TeardownTest(); log.AddRange(testable.GetLogLastTime()); } testResult.Log = log; } return(testResult); }
private void DoTest() { ITestable test = tvProjects.SelectedNode.Tag as ITestable; test.Test(); }
static void Test(ITestable arg) { arg.Test(); }