public static void StartAutomatedRun(AutomatedRun run) { var go = new GameObject("StartAutomatedQAFromEditor"); var init = go.AddComponent <StartAutomatedQAFromEditor>(); init.runConfig = run.config; init.AutomatorName = run.ToString().Replace("(Unity.AutomatedQA.AutomatedRun)", string.Empty).Trim(); EditorApplication.isPlaying = true; RecordingInputModule.isWorkInProgress = true; }
private void addRunButton_Click(object sender, EventArgs e) { if (checkedStations.CheckedItems.Count > 0 && checkedSatellites.CheckedItems.Count > 0) { if (validateRichTextBox()) { EpochTime startTime = new EpochTime(startTimePicker.Value.Hour, startTimePicker.Value.Minute, startTimePicker.Value.Second, startDatePicker.Value.Year, startDatePicker.Value.Month, startDatePicker.Value.Day); EpochTime stopTime = new EpochTime(stopTimePicker.Value.Hour, stopTimePicker.Value.Minute, stopTimePicker.Value.Second, stopDatePicker.Value.Year, stopDatePicker.Value.Month, stopDatePicker.Value.Day); List <string> sats = new List <string>(); for (int i = 0; i < checkedSatellites.Items.Count; i++) { if (checkedSatellites.GetItemChecked(i)) { sats.Add(checkedSatellites.Items[i].ToString()); } } List <string> sta = new List <string>(); for (int i = 0; i < checkedStations.Items.Count; i++) { if (checkedStations.GetItemChecked(i)) { sta.Add(checkedStations.Items[i].ToString()); } } string sett = ""; for (int i = 0; i < SettingsRichTextBox.Lines.Count(); i++) { string ln = SettingsRichTextBox.Lines[i]; if (ln[0] != '#') { int pos = ln.IndexOf('='); sett += ln.Substring(pos + 1); } } AutomatedRun run = new AutomatedRun(schedulerComboBox.Items[schedulerComboBox.SelectedIndex].ToString(), startTime, stopTime, sats, sta, comboScenarioBox.SelectedIndex, objectiveComboBox.Items[objectiveComboBox.SelectedIndex].ToString(), sett, SettingsRichTextBox.Text); runList.Add(run); runsListBox.Items.Add(run.ToString()); } } else { MessageBox.Show("No Stations or Satellites have been selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected IEnumerator LaunchAutomatedRun(AutomatedRun myRun) { ReportingManager.CurrentTestName = myRun.name; ReportingManager.IsAutomatorTest = true; // Run automation until complete CentralAutomationController controller = CentralAutomationController.Instance; controller.Run(myRun.config); while (!controller.IsAutomationComplete()) { yield return(null); } }
private void startAutomatedRun() { results = new List <string>(); progressBar1.Value = 0; progressBar1.Maximum = runList.Count(); results.Add("Results From Automated Run"); results.Add(DateTime.Now.ToString()); for (int i = 0; i < runList.Count; i++) { results.Add("###############"); if (cancel == true) { runList[i].cancelRun(); break; } string name = runsListBox.Items[i].ToString(); results.Add(runList[i].getNameOfScheduler()); results.Add("#Settings Used"); results.Add(runList[i].getSettings()); results.Add("Scenario:"); results.Add(comboScenarioBox.Items[runList[i].getScenario()].ToString()); results.Add("StartTime: " + runList[i].getStartTime().ToString() + " StopTime: " + runList[i].getStopTime().ToString()); results.Add("Stations Used"); results.AddRange(runList[i].getStation()); results.Add("Satellites Used"); results.AddRange(runList[i].getSatellites()); runsListBox.Items[i] = "Running: " + runsListBox.Items[i].ToString(); AutomatedRun currentRun = runList[i]; bool res = runList[i].runThisRun(); Application.DoEvents(); if (res) { runsListBox.Items[i] = "Done: " + name; progressBar1.Value = i + 1; results.AddRange(runList[i].getResults()); } else { runsListBox.Items[i] = "FAILED: " + name; progressBar1.Value = i + 1; } results.Add("###############"); Application.DoEvents(); } startButton.Text = "Start Run"; startButton.BackColor = Color.LightSkyBlue; cancel = false; Log.writeResults("AutomatedRun-" + DateTime.Now.ToString("yyyyMMddHHmmss"), "Automated Run Results", results); }
/// <summary> /// Create single AutomatedRun given sequence of AutomatorConfigs /// </summary> /// <param name="automators"></param> /// <returns>Path of output AutomatedRun</returns> private string GenerateAutomatedRun(List <AutomatorConfig> automators) { AutomatedRun runAsset = CreateInstance <AutomatedRun>(); runAsset.config.automators = automators; // Get available path and save asset string autoRunName = $"{target.name}_AutomatedRun.asset"; string tryPath = Path.Combine(Application.dataPath, "Resources", AutomatorDirectoryName, autoRunName); string availableName = GetAvailableBaseName(tryPath); string creationPath = Path.Combine("Assets", "Resources", AutomatorDirectoryName, availableName); AssetDatabase.CreateAsset(runAsset, creationPath); AssetDatabase.SaveAssets(); Debug.Log("Created run at: " + creationPath); return(creationPath); }
public static void CreateAsset() { AutomatedRun asset = ScriptableObject.CreateInstance <AutomatedRun>(); string assetName = "AutomatedRun.asset"; int i = 0; while (File.Exists(Path.Combine(Application.dataPath, assetName))) { i++; assetName = $"AutomatedRun {i}.asset"; } AssetDatabase.CreateAsset(asset, "Assets/" + assetName); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; }
private void loadRunsFromFile(string filepath) { progressBar1.Value = 0; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filepath); XmlNodeList dataNodes = xmlDoc.SelectNodes("//AutomatedRun/Run"); progressBar1.Maximum = dataNodes.Count; foreach (XmlNode node in dataNodes) { /* * <Scheduler>EFT-Greedy</Scheduler> * <StartYear>2017</StartYear> * <StartEpoch>82.5712962962963</StartEpoch> * <StopYear>2017</StopYear> * <StopYear>83.5712962962963</StopYear> * <Scenario>0</Scenario> * <Settings /> * <SettinsFull /> * <Scheduler>EFT-Greedy</Scheduler> * <Objective>All</Objective> */ string schedulerName = node.SelectSingleNode("Scheduler").InnerText; string startYear = node.SelectSingleNode("StartYear").InnerText; string startEpoch = node.SelectSingleNode("StartEpoch").InnerText; string stopYear = node.SelectSingleNode("StopYear").InnerText; string stopEpoch = node.SelectSingleNode("StopEpoch").InnerText; string scenario = node.SelectSingleNode("Scenario").InnerText; string settings = node.SelectSingleNode("Settings").InnerText; string settingsFull = node.SelectSingleNode("SettinsFull").InnerText; string scheduler = node.SelectSingleNode("Scheduler").InnerText; string objective = node.SelectSingleNode("Objective").InnerText; List <string> satellites = new List <string>(); XmlNodeList satChild = node.SelectNodes("Satellites/SatName"); foreach (XmlNode childNode in satChild) { satellites.Add(childNode.InnerText); } List <string> stations = new List <string>(); XmlNodeList staChild = node.SelectNodes("Stations/StaName"); foreach (XmlNode childNode in staChild) { stations.Add(childNode.InnerText); } EpochTime startTime = new EpochTime(Convert.ToInt32(startYear), Convert.ToDouble(startEpoch)); EpochTime stopTime = new EpochTime(Convert.ToInt32(stopYear), Convert.ToDouble(stopEpoch)); AutomatedRun run = new AutomatedRun(schedulerName, startTime, stopTime, satellites, stations, Convert.ToInt32(scenario), objective, settings, settingsFull); runList.Add(run); runsListBox.Items.Add(run.ToString()); progressBar1.Value = progressBar1.Value + 1; System.Windows.Forms.Application.DoEvents(); } progressBar1.Value = 0; }