public static AutomationTesterHarness RunTest( Action <AutomationTesterHarness> testToRun, string staticDataPathOverride = null, double maxTimeToRun = 60, QueueTemplate queueItemFolderToAdd = QueueTemplate.None) { // Walk back a step in the stack and output the callers name StackTrace st = new StackTrace(false); Console.WriteLine("\r\nRunning automation test: " + st.GetFrames().Skip(1).First().GetMethod().Name); if (staticDataPathOverride == null) { staticDataPathOverride = Path.Combine("..", "..", "..", "..", "StaticData"); } #if !__ANDROID__ // Set the static data to point to the directory of MatterControl StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(staticDataPathOverride); #endif MatterControlUtilities.OverrideAppDataLocation(); if (queueItemFolderToAdd != QueueTemplate.None) { string queueTemplateDirectory = queueItemFolderToAdd.ToString(); MatterControlUtilities.AddItemsToQueue(queueTemplateDirectory); } MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(); return(AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, maxTimeToRun)); }
public static AutomationTesterHarness RunTest(Action <AutomationTesterHarness> testToRun, string testDbFolder = null, string staticDataPathOverride = null, string queueItemFolderToAdd = null, double maxTimeToRun = 60) { if (staticDataPathOverride == null) { staticDataPathOverride = Path.Combine("..", "..", "..", "..", "StaticData"); } #if !__ANDROID__ // Set the static data to point to the directory of MatterControl StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(staticDataPathOverride); #endif bool showWindow; MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewMatterControlAppDataFolderForTesting(testDbFolder); if (queueItemFolderToAdd != null) { MatterControlUtilities.AddItemsToQueue(queueItemFolderToAdd); } MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow); AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, maxTimeToRun); MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true); return(testHarness); }