public List <Simulation> StartTestscenario(Testscenario T) { List <Simulation> failedSimulations = new List <Simulation>(); foreach (var runnable in T.GetTestscenarioRunnables()) { foreach (var simulation in runnable.Run()) { failedSimulations.Add(simulation); } } return(failedSimulations); }
/// <summary> /// Loads the Testscenarios. /// </summary> public void LoadTestscenarios() { testscenarios = new List <Testscenario>(); DirectoryInfo d = new DirectoryInfo(Path.GetDirectoryName(CurrentProject.Path) + "/" + TestscenarioDirectoryName); if (!d.Exists) { return; } foreach (var file in d.GetFiles("*.txt")) { try { Testscenario ts = new Testscenario(File.ReadAllText(file.FullName), CurrentProject.Network, file.FullName); testscenarios.Add(ts); InfoController.Instance.AddTestscenarioToScenarioTab(ts); } catch (IOException) { } } }
private void ScenarioTabPage_StartScenarioButtonClicked(object sender, EventArgs e) { DataRow row = sender as DataRow; if (row == null) { return; } var scenarioNameFull = row["Testszenario Pfad"].ToString(); Testscenario ts = ProjectManager.Instance.GetTestscenarioByName(scenarioNameFull); if (ts == null) { return; } List <Simulation> failedSimulations = SimulationManager.Instance.StartTestscenario(ts); if (failedSimulations.Count == 0) { AddScenarioResultToResultsTab(scenarioNameFull, "Erfolgreich", executedScenarioCount); } else { foreach (Simulation s in failedSimulations) { string simResult = string.Format(baseResult, s.Source, s.Destination, ""); AddScenarioResultToResultsTab(scenarioNameFull, simResult, executedScenarioCount); } AddScenarioResultToResultsTab(scenarioNameFull, "Fehler aufgetreten", executedScenarioCount); } executedScenarioCount++; infoControl.ChangeToResultsTab(); }
/// <summary> /// Adds the testscenario to scenario tab. /// </summary> /// <param name="T">The t.</param> public void AddTestscenarioToScenarioTab(Testscenario T) { infoControl.ScenariosControl.AddTestScenario(T.FileName); }