void StartTestRunner()
		{
			FileUtility.ApplicationRootPath = @"d:\sharpdevelop";
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests tests = new SelectedTests(project);
			testRunner.Start(tests);
		}
		public void CreateResponseFile(SelectedTests selectedTests)
		{
			CreateResponseFile();
			using (responseFile) {
				WriteTests(selectedTests);
			}
		}
Example #3
0
		protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
		{
			resultsFileName = new MSTestResultsFileName(selectedTests).FileName;
			CreateDirectoryForResultsFile();
			var mstestApplication = new MSTestApplication(selectedTests, resultsFileName);
			return mstestApplication.ProcessStartInfo;
		}
        protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
        {
            NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests, options);

            app.Results = base.TestResultsMonitor.FileName;
            return(app.GetProcessStartInfo());
        }
		protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests, options);
			testResultsMonitor = new TestResultsMonitor();
			app.Results = testResultsMonitor.FileName;
			return app.GetProcessStartInfo();
		}
		public void NothingSpecified()
		{
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console-x86.exe", app.FileName);
		}
		protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
		{
			GallioEchoConsoleApplicationProcessStartInfo startInfo = 
				new GallioEchoConsoleApplicationProcessStartInfo(selectedTests, base.TestResultsMonitor.FileName);
			startInfo.ProcessStartInfo.Arguments += " /d";
			return startInfo.ProcessStartInfo;
		}
		string GetFileName(SelectedTests selectedTests)
		{
			return Path.Combine(
				Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
				"Temp",
				selectedTests.Project.Name + "-Results.trx");
		}
		public void Init()
		{
			project = new MockCSharpProject();
			c = new MockClass();
			method = new MockMethod(c);
			selectedTests = new SelectedTests(project, namespaceFilter, c, method);
		}
		public ProcessStartInfo CreateProcessStartInfo(SelectedTests selectedTests)
		{
			consoleApplication.PythonScriptFileName = GetSharpDevelopTestPythonScriptFileName();
			consoleApplication.PythonScriptCommandLineArguments = GetResponseFileNameCommandLineArgument();
			consoleApplication.WorkingDirectory = selectedTests.Project.Directory;
			return consoleApplication.GetProcessStartInfo();
		}
		void CreatePartCoverApplication(SelectedTests selectedTests)
		{
			NUnitConsoleApplication nunitConsoleApp = new NUnitConsoleApplication(selectedTests, options);
			nunitConsoleApp.Results = base.TestResultsMonitor.FileName;
			
			PartCoverSettings settings = settingsFactory.CreatePartCoverSettings(selectedTests.Project);
			partCoverApplication = new PartCoverApplication(nunitConsoleApp, settings);
		}
		public void Init()
		{
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			
			info = app.GetProcessStartInfo();
		}
		void RunTestsOnSelectedTestMethod()
		{
			fileService.SetTempFileName(@"d:\temp\tmp66.tmp");
			CreateTemporaryResponseFileWriter();
			
			selectedTests = new SelectedTests(project, null, null, methodToTest);
			testRunner.Start(selectedTests);
		}
		void CreateNUnitConsoleApplication()
		{
			MockCSharpProject project = new MockCSharpProject();
			selectedTests = new SelectedTests(project);
			
			options = new UnitTestingOptions(new Properties());
			nunitConsoleApp = new NUnitConsoleApplication(selectedTests, options);
		}
		void CreateNUnitTestRunner()
		{
			selectedTests = SelectedTestsHelper.CreateSelectedTestMember();
			context = new MockNUnitTestRunnerContext();
			FileUtility.ApplicationRootPath = @"C:\SharpDevelop";
			
			testRunner = context.CreateNUnitTestRunner();
		}
		public ProcessStartInfo CreateProcessStartInfo(SelectedTests selectedTests)
		{
			consoleApplication.ScriptFileName = GetSharpDevelopTestRubyScriptFileName();
			AddLoadPaths(selectedTests.Project);
			consoleApplication.ScriptCommandLineArguments = GetCommandLineArguments(selectedTests);
			consoleApplication.WorkingDirectory = selectedTests.Project.Directory;
			return consoleApplication.GetProcessStartInfo();
		}
		public void NUnitTestRunnerCreatedWithMockTestResultsMonitor()
		{
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests tests = new SelectedTests(project);
			testRunner.Start(tests);
			
			Assert.IsTrue(context.MockTestResultsMonitor.IsStartMethodCalled);
		}
		public GallioEchoConsoleApplicationProcessStartInfo(SelectedTests selectedTests, string testResultsFileName)
		{
			GallioEchoConsoleApplicationFactory factory = new GallioEchoConsoleApplicationFactory();
			GallioEchoConsoleApplication app = factory.Create(selectedTests);
			SharpDevelopTestRunnerExtensionCommandLineArgument argument = new SharpDevelopTestRunnerExtensionCommandLineArgument();
			argument.TestResultsFileName = testResultsFileName;
			app.TestRunnerExtensions.Add(argument);
			processStartInfo = app.GetProcessStartInfo();
		}
		public void Init()
		{
			projects = new List<IProject>();
			projects.Add(new MockCSharpProject());
			projects.Add(new MockCSharpProject());
			projects.Add(new MockCSharpProject());
			
			selectedTests = new SelectedTests(null, projects.ToArray());
		}
Example #20
0
        /// <summary>
        /// Runs the tests after building the project(s) under test.
        /// </summary>
        void BuildProjectBeforeRunningTests(SelectedTests selectedTests)
        {
            BuildProject build = CreateBuildProjectBeforeTestRun(selectedTests);

            build.BuildComplete += delegate {
                OnBuildComplete(build.LastBuildResults, selectedTests);
            };
            build.Run();
        }
		public void CreateResponseFile(SelectedTests selectedTests)
		{
			CreateResponseFile();
			using (responseFile) {
				WritePythonSystemPaths();
				WriteTestsResultsFileName();
				WriteTests(selectedTests);
			}
		}
		public void NUnitTestRunnerCreatedWithMockProcessRunnerAndUnitTestingOptions()
		{
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests tests = new SelectedTests(project);
			testRunner.Start(tests);
			
			NUnitConsoleApplication app = new NUnitConsoleApplication(tests, context.UnitTestingOptions);
			string expectedArguments = app.GetArguments();
			Assert.AreEqual(expectedArguments, processRunner.CommandArgumentsPassedToStartMethod);
		}
		public override void Start(SelectedTests selectedTests)
		{
			AddProfilerEnvironmentVariableToProcessRunner();
			CreatePartCoverApplication(selectedTests);
			RemoveExistingCodeCoverageResultsFile();
			CreateDirectoryForCodeCoverageResultsFile();
			AppendRunningCodeCoverageMessage();
			
			base.Start(selectedTests);
		}
		public void WriteTests(SelectedTests selectedTests)
		{
			if (selectedTests.Member != null) {
				WriteTestFileNameForMethod(selectedTests.Member);
			} else if (selectedTests.Class != null) {
				WriteTestFileNameForClass(selectedTests.Class);
			} else if (selectedTests.Project != null) {
				WriteTestsForProject(selectedTests.Project);
			}
		}
		public void WriteTestsWritesSelectedTestMethodNameWhenMethodSelected()
		{
			MockMethod method = MockMethod.CreateMockMethodWithoutAnyAttributes();
			method.FullyQualifiedName = "MyNamespace.MyTests.MyTestMethod";
			SelectedTests tests = new SelectedTests(new MockCSharpProject(), null, null, method);
			
			responseFile.WriteTests(tests);
			
			string expectedText = "MyNamespace.MyTests.MyTestMethod\r\n";
			Assert.AreEqual(expectedText, responseFileText.ToString());
		}
		public void WriteTestsWritesSelectedTestClassNameWhenOnlyClassSelected()
		{
			MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();
			c.FullyQualifiedName = "MyNamespace.MyTests";
			SelectedTests tests = new SelectedTests(new MockCSharpProject(), null, c, null);
			
			responseFile.WriteTests(tests);
			
			string expectedText = "MyNamespace.MyTests\r\n";
			Assert.AreEqual(expectedText, responseFileText.ToString());
		}
		public void NoShadowCopy()
		{
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			app.NoLogo = false;
			app.ShadowCopy = false;
			app.NoXmlOutputFile = false;
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /noshadow";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
		public override void Run()
		{
			GetUnitTestsPad(context.OpenUnitTestsPad);
			
			selectedTests = new SelectedTests(Owner, this.unitTestsPad.GetProjects());
			if (selectedTests.HasProjects) {
				runningTestCommand = this;
				BeforeRun();
				BuildAndRunTests();
			}
		}
		public override void Run()
		{
			GetUnitTestsPad();
			
			selectedTests = GetSelectedTests();
			if (selectedTests.HasProjects) {
				runningTestCommand = this;
				BeforeRun();
				BuildAndRunTests();
			}
		}
		public void NUnitConsole32BitUsedWhenTargetCpuIs32Bit()
		{
			MockCSharpProject project = new MockCSharpProject();
			project.ActiveConfiguration = "Debug";
			project.ActivePlatform = "AnyCPU";
			project.SetProperty("PlatformTarget", "x86");
				
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console-x86.exe", app.FileName);			
		}
		public override void Start(SelectedTests selectedTests)
		{
			ProcessStartInfo startInfo = GetProcessStartInfo(selectedTests);
			if (IsDebuggerRunning) {
				if (CanStopDebugging()) {
					debugger.Stop();
					Start(startInfo);
				}
			} else {
				Start(startInfo);
			}
		}
		public void TargetCpuAnyCPUDotnet45()
		{
			MockCSharpProject project = new MockCSharpProject();
			project.ActiveConfiguration = "Debug";
			project.ActivePlatform = "AnyCPU";
			project.SetProperty("PlatformTarget", "AnyCPU");
			project.SetProperty("TargetFrameworkVersion", "v4.5");
			
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console.exe", app.FileName);
		}
Example #33
0
        public override void Run()
        {
            GetUnitTestsPad(context.OpenUnitTestsPad);

            selectedTests = new SelectedTests(Owner, this.unitTestsPad.GetProjects());
            if (selectedTests.HasProjects)
            {
                runningTestCommand = this;
                BeforeRun();
                BuildAndRunTests();
            }
        }
Example #34
0
        public override void Run()
        {
            GetUnitTestsPad();

            selectedTests = GetSelectedTests();
            if (selectedTests.HasProjects)
            {
                runningTestCommand = this;
                BeforeRun();
                BuildAndRunTests();
            }
        }
Example #35
0
 /// <summary>
 /// Runs the test for the project after a successful build.
 /// </summary>
 void OnBuildComplete(BuildResults results, SelectedTests selectedTests)
 {
     if (BuildHasNoErrorsAndStillRunningTests(results))
     {
         RunTests(selectedTests);
     }
     else
     {
         if (IsRunningTest)
         {
             Stop();
         }
         ShowErrorList();
     }
 }
Example #36
0
        void RunTests(SelectedTests selectedTests)
        {
            if (testProgressMonitor == null)
            {
                OnBeforeRunTests();
                testProgressMonitor = context.StatusBarService.CreateProgressMonitor();
                totalProjectCount   = selectedTests.ProjectsCount;
            }
            testProgressMonitor.TaskName = GetProgressMonitorLabel(selectedTests.Project);
            testProgressMonitor.Progress = GetProgress(selectedTests.ProjectsCount);

            testRunner = CreateTestRunner(selectedTests.Project);
            if (testRunner != null)
            {
                StartTestRunner();
            }
        }
Example #37
0
        public override void Start(SelectedTests selectedTests)
        {
            ProcessStartInfo startInfo = GetProcessStartInfo(selectedTests);

            if (IsDebuggerRunning)
            {
                if (CanStopDebugging())
                {
                    debugger.Stop();
                    Start(startInfo);
                }
            }
            else
            {
                Start(startInfo);
            }
        }
 void Initialize(SelectedTests selectedTests)
 {
     this.selectedTests = selectedTests;
     this.project       = selectedTests.Project;
     Assemblies.Add(project.OutputAssemblyFullPath);
     if (selectedTests.NamespaceFilter != null)
     {
         NamespaceFilter = selectedTests.NamespaceFilter;
     }
     if (selectedTests.Class != null)
     {
         Fixture = selectedTests.Class.DotNetName;
         if (selectedTests.Method != null)
         {
             Test = selectedTests.Method.Name;
         }
     }
 }
Example #39
0
 IEnumerable <IProject> GetProjectsRequiringBuildBeforeTestRun(SelectedTests selectedTests)
 {
     return(selectedTests
            .Projects
            .Where(p => context.RegisteredTestFrameworks.IsBuildNeededBeforeTestRunForProject(p)));
 }
Example #40
0
        BuildProject CreateBuildProjectBeforeTestRun(SelectedTests selectedTests)
        {
            IEnumerable <IProject> projects = GetProjectsRequiringBuildBeforeTestRun(selectedTests);

            return(context.BuildProjectFactory.CreateBuildProjectBeforeTestRun(projects));
        }
Example #41
0
 public abstract void Start(SelectedTests selectedTests);
 public NUnitConsoleApplication(SelectedTests selectedTests, UnitTestingOptions options)
 {
     Initialize(selectedTests);
     InitializeOptions(options);
 }
Example #43
0
 protected virtual ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
 {
     return(new ProcessStartInfo());
 }
        public override void Start(SelectedTests selectedTests)
        {
            ProcessStartInfo startInfo = GetProcessStartInfo(selectedTests);

            Start(startInfo);
        }
 public NUnitConsoleApplication(SelectedTests selectedTests)
 {
     Initialize(selectedTests);
 }
Example #46
0
        BuildProject CreateBuildProjectBeforeTestRun(SelectedTests selectedTests)
        {
            var projects = selectedTests.Projects.Where(p => context.RegisteredTestFrameworks.IsBuildNeededBeforeTestRunForProject(p));

            return(context.BuildProjectFactory.CreateBuildProjectBeforeTestRun(projects));
        }