예제 #1
0
        public void LaunchPythonProfilingWizard()
        {
            var app     = new PythonVisualStudioApp(VsIdeTestHostContext.Dte);
            var project = DebugProject.OpenProject(@"Python.VS.TestData\ProfileTest.sln");

            app.LaunchPythonProfiling();

            // wait for the dialog, set some settings, save them.
            var perfTarget = new PythonPerfTarget(app.WaitForDialog());

            perfTarget.SelectProfileProject();

            perfTarget.SelectedProjectComboBox.SelectItem("HelloWorld");

            perfTarget.Ok();
            app.WaitForDialogDismissed();

            var profiling = (IPythonProfiling)VsIdeTestHostContext.Dte.GetObject("PythonProfiling");
            var session   = profiling.GetSession(1);

            try {
                Assert.AreNotEqual(null, app.PythonPerformanceExplorerTreeView.WaitForItem("HelloWorld *"));

                while (profiling.IsProfiling)
                {
                    // wait for profiling to finish...
                    System.Threading.Thread.Sleep(100);
                }
            } finally {
                profiling.RemoveSession(session, true);
            }
        }
예제 #2
0
        public void NewProfilingSessionOpenSolution()
        {
            var app     = new PythonVisualStudioApp(VsIdeTestHostContext.Dte);
            var project = DebugProject.OpenProject(@"Python.VS.TestData\ProfileTest.sln");

            app.PythonPerformanceExplorerToolBar.NewPerfSession();

            var profiling = (IPythonProfiling)VsIdeTestHostContext.Dte.GetObject("PythonProfiling");

            var perf = app.PythonPerformanceExplorerTreeView.WaitForItem("Performance");

            var session = profiling.GetSession(1);

            Assert.AreNotEqual(session, null);

            try {
                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // wait for the dialog, set some settings, save them.
                var perfTarget = new PythonPerfTarget(app.WaitForDialog());

                perfTarget.SelectProfileProject();

                perfTarget.SelectedProjectComboBox.SelectItem("HelloWorld");

                perfTarget.Ok();
                app.WaitForDialogDismissed();

                Mouse.MoveTo(perf.GetClickablePoint());
                Mouse.DoubleClick(System.Windows.Input.MouseButton.Left);

                // re-open the dialog, verify the settings
                perfTarget = new PythonPerfTarget(app.WaitForDialog());

                Assert.AreEqual("HelloWorld", perfTarget.SelectedProject);

                perfTarget.Ok();
            } finally {
                profiling.RemoveSession(session, true);
            }
        }