Exemplo n.º 1
0
        public static AutomationTesterHarness RunTest(
            Action <AutomationTesterHarness> testToRun,
            string staticDataPathOverride      = null,
            double maxTimeToRun                = 60,
            QueueTemplate queueItemFolderToAdd = QueueTemplate.None,
            int overrideWidth = -1, int overrideHeight = -1)
        {
            if (staticDataPathOverride == null)
            {
                // Popping one directory above MatterControl, then back down into MatterControl ensures this works in MCCentral as well and MatterControl
                staticDataPathOverride = TestContext.CurrentContext.ResolveProjectPath(5, "MatterControl", "StaticData");
            }

#if !__ANDROID__
            // Set the static data to point to the directory of MatterControl
            StaticData.Instance = new FileSystemStaticData(staticDataPathOverride);
#endif
            // Popping one directory above MatterControl, then back down into MatterControl ensures this works in MCCentral as well and MatterControl
            MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(5, "MatterControl"));

            if (queueItemFolderToAdd != QueueTemplate.None)
            {
                string queueTemplateDirectory = queueItemFolderToAdd.ToString();
                MatterControlUtilities.AddItemsToQueue(queueTemplateDirectory);
            }

            MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(overrideWidth, overrideHeight);
            return(AutomationTesterHarness.ShowWindowAndExecuteTests(matterControlWindow, testToRun, maxTimeToRun));
        }
Exemplo n.º 2
0
        public static AutomationTesterHarness RunTest(
            Action <AutomationTesterHarness> testToRun,
            string staticDataPathOverride      = null,
            double maxTimeToRun                = 60,
            QueueTemplate queueItemFolderToAdd = QueueTemplate.None,
            int overrideWidth = -1, int overrideHeight = -1)
        {
            // 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(overrideWidth, overrideHeight);
            return(AutomationTesterHarness.ShowWindowAndExecuteTests(matterControlWindow, testToRun, maxTimeToRun));
        }