public static ProcessStartInfo CreateTestAndCoverageProcessStartInfo(Settings settings, string[] fileNames) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = true; startInfo.UseShellExecute = false; startInfo.FileName = @"""" + settings.PartCoverPath + @""""; startInfo.Arguments += " --target "; startInfo.Arguments += @"""" + settings.MSTestPath + @""""; startInfo.Arguments += " --target-work-dir "; startInfo.Arguments += @"""" + settings.OutputPath + @""""; // trim trailing slash? startInfo.Arguments += " --target-args "; startInfo.Arguments += @""""; foreach (string fileName in fileNames) { FileInfo f = new FileInfo(fileName); startInfo.Arguments += " /testcontainer:"; startInfo.Arguments += f.Name; } startInfo.Arguments += " /noisolation"; startInfo.Arguments += " /nologo"; startInfo.Arguments += " /resultsfile:"; startInfo.Arguments += settings.TestLogFileName; startInfo.Arguments += @""""; startInfo.Arguments += " --include " + settings.CoverageReportingAssembliesRegEx; startInfo.Arguments += " --output " + @"""" + Path.Combine(settings.OutputPath, settings.CoverageLogFileName) + @""""; return startInfo; }
public void GetLogFilePath_RegularDate_ValidValue() { DateTime now = new DateTime(2010, 11, 24, 13, 55, 44); Settings settings = new Settings() { BasePath = @"c:\" }; string result = StatisticsLogger.GetLogFilePath(now, settings); Assert.AreEqual(@"c:\20101124.xml", result); }
public ContinuousIntegrationClientProcess(Settings settings) { _settings = settings; _fileSystem = new FileSystem(); _processes = new List<BaseProcess>(); _processes.Add(new CompileProcess(_settings)); _processes.Add(new TestProcess(_settings)); // _processes.Add(new StyleCopProcess(_settings)); }
public static ProcessStartInfo CreateCompileProcessStartInfo(Settings settings) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = true; startInfo.UseShellExecute = false; startInfo.FileName = @"""" + settings.MSBuildPath + @""""; startInfo.Arguments = @"""" + settings.SolutionPath + @""""; startInfo.Arguments += " /p:OutputPath="; startInfo.Arguments += @"""" + settings.OutputPath + @""""; startInfo.Arguments += @" /flp:logfile="; startInfo.Arguments += @"""" + settings.GetBuildLogPath() + @""""; return startInfo; }
private void LogEvent(Settings settings, string eventName) { DateTime now = DateTime.Now; string path = GetLogFilePath(now, settings); string timestamp = GetTimeStamp(now); XmlDocument doc = GetXmlDocument(path); XmlNode root = GetRootNode(doc); AppendEventNode(eventName, timestamp, doc, root); Save(doc, path); }
public void LogStatistics(Settings settings, ProcessResult result) { DateTime now = DateTime.Now; string path = GetLogFilePath(now, settings); string timestamp = GetTimeStamp(now); XmlDocument doc = GetXmlDocument(path); XmlNode root = GetRootNode(doc); AppendTimestampNode(result, timestamp, doc, root); Save(doc, path); }
public void GettersAndSetters() { Settings settings = new Settings(); settings.BasePath = @"c:\"; settings.BuildLogFileName = "buildlog.log"; settings.CleanUp = true; settings.CompileInterval = 2; Assert.AreEqual(@"c:\", settings.BasePath); Assert.AreEqual("buildlog.log", settings.BuildLogFileName); Assert.AreEqual(true, settings.CleanUp); Assert.AreEqual(2, settings.CompileInterval); }
private void TestEventAdded(StatisticsLoggerStub stub, LogEvent ev, string eventtype) { Settings settings = new Settings(); settings.BasePath = @"c:\"; ev(settings); XmlDocument result = stub.XmlDocument; string xpath = string.Format("timestamps/timestamp/event[@type='{0}']", eventtype); XmlNodeList nodes = result.SelectNodes(xpath); Assert.AreEqual(1, nodes.Count); Assert.IsTrue(stub.IsSaved); }
public void CleanUp() { Settings settings = new Settings(); settings.BasePath = @"c:\"; settings.CleanUp = true; FakeFileSystem fs = new FakeFileSystem(); List<BaseProcess> processes = new List<BaseProcess>(); ContinuousIntegrationClientProcess cp = new ContinuousIntegrationClientProcess(settings, fs, processes); ProcessResult rresult = cp.Start(); Assert.IsNotNull(rresult); Assert.IsTrue(fs.HasCleanedUp); }
public void CreateStyleCopProcessStartInfo_AllSettingsValid_ValidResult() { Settings settings = new Settings(); settings.StyleCopPath = @"C:\Program Files\StyleCopCmd-bin-0.2.1.0\Net.SF.StyleCopCmd.Console\StyleCopCmd.exe"; settings.SolutionPath = @"c:\solution\test.sln"; settings.OutputPath = @"c:\"; settings.StyleCopLogFileName = "result.xml"; settings.StyleCopStyleSheet = @"c:\stylesheet.xsl"; settings.StyleCopSettingsfile = @"c:\stylecop.settings"; ProcessStartInfo info = ProcessStartInfoFactory.CreateStyleCopProcessStartInfo(settings); string expected = @"-sf ""c:\solution\test.sln"" -of ""c:\result.xml"" -tf ""c:\stylesheet.xsl"" -sc ""c:\stylecop.settings"""; Assert.AreEqual(@"""C:\Program Files\StyleCopCmd-bin-0.2.1.0\Net.SF.StyleCopCmd.Console\StyleCopCmd.exe""", info.FileName); Assert.AreEqual(expected, info.Arguments); }
public void CreateWithEmptySettings() { Settings settings = new Settings(); settings.BasePath = @"c:\"; settings.CleanUp = true; IFileSystem fs = new FakeFileSystem(); List<BaseProcess> processes = new List<BaseProcess>(); processes.Add(new SuceedingProcess()); processes.Add(new FailingProcess()); ContinuousIntegrationClientProcess cp = new ContinuousIntegrationClientProcess(settings, fs, processes); ProcessResult rresult = cp.Start(); Assert.IsNotNull(rresult); }
public FormConfigure(Settings settings) { _settings = settings; InitializeComponent(); this.textBoxSolutionFile.Text = _settings.SolutionPath; this.textBoxMSTestPath.Text = _settings.MSTestPath; this.textBoxPartcoverPath.Text = _settings.PartCoverPath; this.textBoxMSBuildPath.Text = _settings.MSTestPath; this.textBoxCompileMinutes.Text = (_settings.CompileInterval / 60000).ToString(); this.textBoxTimerDuration.Text = _settings.TimerInterval.ToString(); this.checkBox1.Checked = _settings.CleanUp; this.textBoxBasePath.Text = _settings.BasePath; ValidatePaths(); }
public void CreateCompileProcessStartInfo_AllSettingsValid_ValidResult() { Settings settings = new Settings(); settings.MSBuildPath = @"c:\msbuild\msbuild.exe"; settings.SolutionPath = @"c:\solution\test.sln"; settings.OutputPath = @"c:\output\"; settings.BuildLogFileName = "build.log"; ProcessStartInfo info = ProcessStartInfoFactory.CreateCompileProcessStartInfo(settings); string arguments = info.Arguments; // "c:\solution\test.sln" /p:OutputPath="c:\output\" /flp:logfile="c:\output\build.log"; string expected = @"""c:\solution\test.sln"" /p:OutputPath=""c:\output\"" /flp:logfile=""c:\output\build.log"""; Assert.AreEqual(@"""c:\msbuild\msbuild.exe""", info.FileName); Assert.AreEqual(expected, arguments); }
public void CreateTestProcessStartInfo_AllSettingsValid_ValidResult() { Settings settings = new Settings(); settings.MSTestPath = @"c:\mstest\mstest.exe"; settings.OutputPath = @"c:\output\"; settings.TestLogFileName = "testlog.log"; string[] fileNames = new string[] { "file1.dll", "file2.dll" }; ProcessStartInfo info = ProcessStartInfoFactory.CreateTestProcessStartInfo(settings, fileNames); string arguments = info.Arguments; // "c:\output\file1.dll" /testcontainer:"c:\output\file2.dll" /nologo /resultsfile:"c:\output\testlog.log" string expected = @" /testcontainer:""c:\output\file1.dll"" /testcontainer:""c:\output\file2.dll"" /nologo /resultsfile:""c:\output\testlog.log"""; Assert.AreEqual(@"""c:\mstest\mstest.exe""", info.FileName); Assert.AreEqual(expected, arguments); }
public void LogEvent_BuildFailure_AddEvent_EvellntAdded() { Settings settings = new Settings(); settings.BasePath = @"c:\"; StatisticsLoggerStub stub = new StatisticsLoggerStub(); ProcessResult r = new ProcessResult(); r.TestResults.CoveredAssemblies = new CoveredAssemblySet(); CoveredAssembly assembly = new CoveredAssembly(); assembly.Name = "thename"; r.TestResults.CoveredAssemblies.Add(assembly); stub.LogStatistics(settings, r); Assert.AreEqual(1, stub.XmlDocument.SelectNodes("timestamps/timestamp/assembly[@id='thename']").Count); Assert.IsTrue(stub.IsSaved); }
public FormSessionChart(Settings settings) { InitializeComponent(); string filenameToMonitor = ""; _basePathToMonitor = settings.BasePath; InitializeFileToMonitor(filenameToMonitor); _initialTitle = this.Text; _continousTestingTimer_Tick(null, null); //setup timer _continousTestingTimer = new Timer(); _continousTestingTimer.Interval = 10000; //10 seconds _continousTestingTimer.Tick += new EventHandler(_continousTestingTimer_Tick); _continousTestingTimer.Start(); }
public static ProcessStartInfo CreateStyleCopProcessStartInfo(Settings settings) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = true; startInfo.UseShellExecute = false; startInfo.FileName = @"""" + settings.StyleCopPath + @""""; startInfo.Arguments += "-sf "; startInfo.Arguments += @"""" + settings.SolutionPath + @""""; startInfo.Arguments += " -of "; startInfo.Arguments += @"""" + Path.Combine(settings.OutputPath, settings.StyleCopLogFileName) + @""""; startInfo.Arguments += " -tf "; startInfo.Arguments += @"""" + settings.StyleCopStyleSheet + @""""; startInfo.Arguments += " -sc "; startInfo.Arguments += @"""" + settings.StyleCopSettingsfile + @""""; return startInfo; }
public static ProcessStartInfo CreateTestProcessStartInfo(Settings settings, string[] fileNames) { ////// Use ProcessStartInfo class ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = true; startInfo.UseShellExecute = false; startInfo.FileName = @"""" + settings.MSTestPath + @""""; foreach (string fileName in fileNames) { FileInfo f = new FileInfo(fileName); startInfo.Arguments += " /testcontainer:"; startInfo.Arguments += @"""" + settings.GetTestAssemblyPath(f.Name) + @""""; } startInfo.Arguments += " /nologo"; startInfo.Arguments += " /resultsfile:"; startInfo.Arguments += @"""" + settings.GetTestLogPath() + @""""; return startInfo; }
public void CreateTestAndCoverageProcessStartInfo_AllSettingsValid_ValidResult() { Settings settings = new Settings(); settings.MSTestPath = @"c:\mstest\mstest.exe"; settings.OutputPath = @"c:\output\"; settings.TestLogFileName = "testlog.log"; settings.CoverageLogFileName = "coveragelog.log"; settings.CoverageReportingAssembliesRegEx = "REGEX"; settings.PartCoverPath = @"c:\partcover\partcover.exe"; string[] fileNames = new string[] { "file1.dll", "file2.dll" }; ProcessStartInfo info = ProcessStartInfoFactory.CreateTestAndCoverageProcessStartInfo(settings, fileNames); // " --target "c:\mstest\mstest.exe" --target-work-dir "c:\output\" --target-args " /testcontainer:file1.dll /testcontainer:file2.dll /noisolation /nologo /resultsfile:testlog.log" --include REGEX --output "c:\output\coveragelog.log" string expected = @" --target ""c:\mstest\mstest.exe"" --target-work-dir ""c:\output\"" --target-args "" /testcontainer:file1.dll /testcontainer:file2.dll /noisolation /nologo /resultsfile:testlog.log"" --include REGEX --output ""c:\output\coveragelog.log"""; Assert.AreEqual(@"""c:\partcover\partcover.exe""", info.FileName); Assert.AreEqual(expected, info.Arguments); }
public void LogEvent_StartTimer(Settings settings) { LogEvent(settings, "starttimer"); }
/// <summary> /// Initializes a new instance of the ContinuousIntegrationClientProcess for testing purposes /// </summary> /// <param name="settings"></param> /// <param name="fileSystem"></param> public ContinuousIntegrationClientProcess(Settings settings, IFileSystem fileSystem, List<BaseProcess> processes) { _settings = settings; _fileSystem = fileSystem; _processes = processes; }
/// <summary> /// Initializes a new instance of the BaseProcess class /// </summary> /// <param name="settings"></param> public BaseProcess(Settings settings) { _settings = settings; }
public CompileProcess(Settings settings) : base(settings) { }
private void ReadSettings() { _settings = new Settings(); _settings.BuildLogFileName = "buildresults.txt"; _settings.TestLogFileName = "testresults.xml"; _settings.CoverageLogFileName = "partcoverresults.xml"; _settings.SolutionPath = Properties.Settings.Default.SolutionPath; // read the interval from the settings _settings.TimerInterval = Properties.Settings.Default.TimerMinutes; _settings.CompileInterval = Properties.Settings.Default.CompileIntervalMilliseconds; _settings.CleanUp = Properties.Settings.Default.CleanupAfterCompile; _settings.UseCoverage = Properties.Settings.Default.UseCoverage; _settings.BasePath = Properties.Settings.Default.BaseCompilePath; _settings.OutputPath = _settings.BasePath; _settings.MSBuildPath = Properties.Settings.Default.MSBuildPath; _settings.MSTestPath = Properties.Settings.Default.MSTestPath; _settings.PartCoverPath = Properties.Settings.Default.PartCoverPath; _settings.CoverageReportingAssembliesRegEx = Properties.Settings.Default.CoverageReportingAssembliesRegEx; }
public static string GetLogFilePath(DateTime now, Settings settings) { string fileName = now.Year.ToString() + now.Month.ToString().PadLeft(2, '0') + now.Day.ToString().PadLeft(2, '0') + ".xml"; string path = System.IO.Path.Combine(settings.BasePath, fileName); return path; }
public TestProcess(Settings settings) : base(settings) { }
public void LogEvent_BuildSuccess(Settings settings) { LogEvent(settings, "buildsuccess"); }
public void LogEvent_BuildFailure(Settings settings) { LogEvent(settings, "buildfailure"); }
public void LogEvent_EndTimer(Settings settings) { LogEvent(settings, "endtimer"); }
public StyleCopProcess(Settings settings) : base(settings) { }