public void RunNantAndExecTaskWithArgumentsOnSingleAndMultiLines() { const string ProjectName1 = "NantTest01"; string IntegrationFolder = System.IO.Path.Combine("scenarioTests", ProjectName1); string CCNetConfigFile = System.IO.Path.Combine("IntegrationScenarios", "NantAndExecTestMultiLineBuildArgs.xml"); string ProjectStateFile = new System.IO.FileInfo(ProjectName1 + ".state").FullName; IntegrationCompleted = new System.Collections.Generic.Dictionary <string, bool>(); string workingDirectory = "Nant01"; var ios = new CCNet.Core.Util.IoService(); ios.DeleteIncludingReadOnlyObjects(workingDirectory); System.IO.Directory.CreateDirectory(workingDirectory); string NantBuildFile = @"IntegrationScenarios\Nant.Build"; var NantExeLocation = ""; #if DEBUG NantExeLocation = @"..\..\..\..\Tools\Nant\nant.exe"; #else NantExeLocation = @"..\..\Tools\Nant\nant.exe"; #endif var configFileData = System.IO.File.ReadAllText(CCNetConfigFile); configFileData = configFileData.Replace("WillBeReplacedViaTheTest", NantExeLocation); System.IO.File.WriteAllText(CCNetConfigFile, configFileData); System.IO.File.Copy(NantBuildFile, System.IO.Path.Combine(workingDirectory, new System.IO.FileInfo(NantBuildFile).Name)); IntegrationCompleted.Add(ProjectName1, false); Log("Clear existing state file, to simulate first run : " + ProjectStateFile); System.IO.File.Delete(ProjectStateFile); Log("Clear integration folder to simulate first run"); if (System.IO.Directory.Exists(IntegrationFolder)) { System.IO.Directory.Delete(IntegrationFolder, true); } CCNet.Remote.Messages.ProjectStatusResponse psr; CCNet.Remote.Messages.ProjectRequest pr1 = new CCNet.Remote.Messages.ProjectRequest(null, ProjectName1); Log("Making CruiseServerFactory"); CCNet.Core.CruiseServerFactory csf = new CCNet.Core.CruiseServerFactory(); Log("Making cruiseServer with config from :" + CCNetConfigFile); using (var cruiseServer = csf.Create(true, CCNetConfigFile)) { // subscribe to integration complete to be able to wait for completion of a build cruiseServer.IntegrationCompleted += new EventHandler <ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("Starting cruiseServer"); cruiseServer.Start(); System.Threading.Thread.Sleep(250); // give time to start Log("Forcing build"); CheckResponse(cruiseServer.ForceBuild(pr1)); System.Threading.Thread.Sleep(250); // give time to start the build Log("Waiting for integration to complete"); while (!IntegrationCompleted[ProjectName1]) { for (int i = 1; i <= 4; i++) { System.Threading.Thread.Sleep(250); } Log(" waiting ..."); } // un-subscribe to integration complete cruiseServer.IntegrationCompleted -= new EventHandler <ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("getting project status"); psr = cruiseServer.GetProjectStatus(pr1); CheckResponse(psr); Log("Stopping cruiseServer"); cruiseServer.Stop(); Log("waiting for cruiseServer to stop"); cruiseServer.WaitForExit(pr1); Log("cruiseServer stopped"); } Log("Checking the data"); CCNet.Remote.ProjectStatus ps = null; // checking data of project 1 foreach (var p in psr.Projects) { if (p.Name == ProjectName1) { ps = p; } } Assert.AreEqual(ProjectName1, ps.Name); Assert.AreEqual(CCNet.Remote.IntegrationStatus.Success, ps.BuildStatus, "wrong build state for project " + ProjectName1); }
public void RunSomeTasksInParallel() { const string ProjectName1 = "Task01"; string IntegrationFolder = System.IO.Path.Combine("scenarioTests", ProjectName1); string CCNetConfigFile = System.IO.Path.Combine("IntegrationScenarios", "ParallelTaskTest01.xml"); string ProjectStateFile = new System.IO.FileInfo(ProjectName1 + ".state").FullName; IntegrationCompleted = new System.Collections.Generic.Dictionary <string, bool>(); string workingDirectory = "TaskTest01"; var ios = new CCNet.Core.Util.IoService(); ios.DeleteIncludingReadOnlyObjects(workingDirectory); IntegrationCompleted.Add(ProjectName1, false); Log("Clear existing state file, to simulate first run : " + ProjectStateFile); System.IO.File.Delete(ProjectStateFile); Log("Clear integration folder to simulate first run"); if (System.IO.Directory.Exists(IntegrationFolder)) { System.IO.Directory.Delete(IntegrationFolder, true); } CCNet.Remote.Messages.ProjectStatusResponse psr; CCNet.Remote.Messages.ProjectRequest pr1 = new CCNet.Remote.Messages.ProjectRequest(null, ProjectName1); Log("Making CruiseServerFactory"); CCNet.Core.CruiseServerFactory csf = new CCNet.Core.CruiseServerFactory(); Log("Making cruiseServer with config from :" + CCNetConfigFile); using (var cruiseServer = csf.Create(true, CCNetConfigFile)) { // subscribe to integration complete to be able to wait for completion of a build cruiseServer.IntegrationCompleted += new EventHandler <ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("Starting cruiseServer"); cruiseServer.Start(); System.Threading.Thread.Sleep(250); // give time to start Log("Forcing build"); CheckResponse(cruiseServer.ForceBuild(pr1)); System.Threading.Thread.Sleep(250); // give time to start the build Log("Waiting for integration to complete"); while (!IntegrationCompleted[ProjectName1]) { for (int i = 1; i <= 4; i++) { System.Threading.Thread.Sleep(250); } Log(" waiting ..."); } // un-subscribe to integration complete cruiseServer.IntegrationCompleted -= new EventHandler <ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("getting project status"); psr = cruiseServer.GetProjectStatus(pr1); CheckResponse(psr); Log("Stopping cruiseServer"); cruiseServer.Stop(); Log("waiting for cruiseServer to stop"); cruiseServer.WaitForExit(pr1); Log("cruiseServer stopped"); } Log("Checking the data"); }
public void PackagePublisherPackageFolderMustRespectHierarchy() { const string ProjectName1 = "PackageTest03"; string IntegrationFolder = System.IO.Path.Combine("scenarioTests", ProjectName1); string CCNetConfigFile = System.IO.Path.Combine("IntegrationScenarios", "PackagePublisherTest03.xml"); string ProjectStateFile = new System.IO.FileInfo(ProjectName1 + ".state").FullName; IntegrationCompleted = new System.Collections.Generic.Dictionary <string, bool>(); string workingDirectory = "Packaging03"; string infoFolder = string.Format("{0}{1}some{1}directories{1}deeper{1}_PublishedWebsites{1}MyProject{1}", workingDirectory, System.IO.Path.DirectorySeparatorChar); string subInfoFolder = string.Format("{0}{1}AFolder{1}", infoFolder, System.IO.Path.DirectorySeparatorChar); string f1 = string.Format("{0}{1}a.txt", infoFolder, System.IO.Path.DirectorySeparatorChar); string f2 = string.Format("{0}{1}b.txt", subInfoFolder, System.IO.Path.DirectorySeparatorChar); var ios = new CCNet.Core.Util.IoService(); ios.DeleteIncludingReadOnlyObjects(infoFolder); ios.DeleteIncludingReadOnlyObjects("TheMegaWebSite"); System.IO.Directory.CreateDirectory(infoFolder); System.IO.Directory.CreateDirectory(subInfoFolder); System.IO.File.WriteAllText(f1, "somedata"); System.IO.File.WriteAllText(f2, "somedata"); IntegrationCompleted.Add(ProjectName1, false); Log("Clear existing state file, to simulate first run : " + ProjectStateFile); System.IO.File.Delete(ProjectStateFile); Log("Clear integration folder to simulate first run"); if (System.IO.Directory.Exists(IntegrationFolder)) { System.IO.Directory.Delete(IntegrationFolder, true); } CCNet.Remote.Messages.ProjectStatusResponse psr; CCNet.Remote.Messages.ProjectRequest pr1 = new CCNet.Remote.Messages.ProjectRequest(null, ProjectName1); Log("Making CruiseServerFactory"); CCNet.Core.CruiseServerFactory csf = new CCNet.Core.CruiseServerFactory(); Log("Making cruiseServer with config from :" + CCNetConfigFile); using (var cruiseServer = csf.Create(true, CCNetConfigFile)) { // subscribe to integration complete to be able to wait for completion of a build cruiseServer.IntegrationCompleted += new EventHandler <ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("Starting cruiseServer"); cruiseServer.Start(); System.Threading.Thread.Sleep(250); // give time to start Log("Forcing build"); CheckResponse(cruiseServer.ForceBuild(pr1)); System.Threading.Thread.Sleep(250); // give time to start the build Log("Waiting for integration to complete"); while (!IntegrationCompleted[ProjectName1]) { for (int i = 1; i <= 4; i++) { System.Threading.Thread.Sleep(250); } Log(" waiting ..."); } // un-subscribe to integration complete cruiseServer.IntegrationCompleted -= new EventHandler <ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("getting project status"); psr = cruiseServer.GetProjectStatus(pr1); CheckResponse(psr); Log("Stopping cruiseServer"); cruiseServer.Stop(); Log("waiting for cruiseServer to stop"); cruiseServer.WaitForExit(pr1); Log("cruiseServer stopped"); } Log("Checking the data"); string ExpectedZipFile = string.Format("{0}{1}Artifacts{1}1{1}Project-package.zip", ProjectName1, System.IO.Path.DirectorySeparatorChar); Assert.IsTrue(System.IO.File.Exists(ExpectedZipFile), "zip package not found at expected location"); ICSharpCode.SharpZipLib.Zip.ZipFile zf = new ICSharpCode.SharpZipLib.Zip.ZipFile(ExpectedZipFile); string expectedFiles = string.Empty; foreach (ICSharpCode.SharpZipLib.Zip.ZipEntry ze in zf) { System.Diagnostics.Debug.WriteLine(ze.Name); expectedFiles += ze.Name; } Assert.AreEqual(@"MegaWebSite/AFolder/b.txtMegaWebSite/a.txt", expectedFiles); }
public void RunSomeTasksInParallel() { const string ProjectName1 = "Task01"; string IntegrationFolder = System.IO.Path.Combine("scenarioTests", ProjectName1); string CCNetConfigFile = System.IO.Path.Combine("IntegrationScenarios", "ParallelTaskTest01.xml"); string ProjectStateFile = new System.IO.FileInfo(ProjectName1 + ".state").FullName; IntegrationCompleted = new System.Collections.Generic.Dictionary<string, bool>(); string workingDirectory = "TaskTest01"; var ios = new CCNet.Core.Util.IoService(); ios.DeleteIncludingReadOnlyObjects(workingDirectory); IntegrationCompleted.Add(ProjectName1, false); Log("Clear existing state file, to simulate first run : " + ProjectStateFile); System.IO.File.Delete(ProjectStateFile); Log("Clear integration folder to simulate first run"); if (System.IO.Directory.Exists(IntegrationFolder)) System.IO.Directory.Delete(IntegrationFolder, true); CCNet.Remote.Messages.ProjectStatusResponse psr; CCNet.Remote.Messages.ProjectRequest pr1 = new CCNet.Remote.Messages.ProjectRequest(null, ProjectName1); Log("Making CruiseServerFactory"); CCNet.Core.CruiseServerFactory csf = new CCNet.Core.CruiseServerFactory(); Log("Making cruiseServer with config from :" + CCNetConfigFile); using (var cruiseServer = csf.Create(true, CCNetConfigFile)) { // subscribe to integration complete to be able to wait for completion of a build cruiseServer.IntegrationCompleted += new EventHandler<ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("Starting cruiseServer"); cruiseServer.Start(); System.Threading.Thread.Sleep(250); // give time to start Log("Forcing build"); CheckResponse(cruiseServer.ForceBuild(pr1)); System.Threading.Thread.Sleep(250); // give time to start the build Log("Waiting for integration to complete"); while (!IntegrationCompleted[ProjectName1]) { for (int i = 1; i <= 4; i++) System.Threading.Thread.Sleep(250); Log(" waiting ..."); } // un-subscribe to integration complete cruiseServer.IntegrationCompleted -= new EventHandler<ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("getting project status"); psr = cruiseServer.GetProjectStatus(pr1); CheckResponse(psr); Log("Stopping cruiseServer"); cruiseServer.Stop(); Log("waiting for cruiseServer to stop"); cruiseServer.WaitForExit(pr1); Log("cruiseServer stopped"); } Log("Checking the data"); }
public void RunNantWhenFailureUsersHaveQuoutesInTheirNames() { const string ProjectName1 = "NantTest02"; string IntegrationFolder = System.IO.Path.Combine("scenarioTests", ProjectName1); string CCNetConfigFile = System.IO.Path.Combine("IntegrationScenarios", "NantFailureUsersWithQuote.xml"); string ProjectStateFile = new System.IO.FileInfo(ProjectName1 + ".state").FullName; IntegrationCompleted = new System.Collections.Generic.Dictionary<string, bool>(); string workingDirectory = "Nant02"; var ios = new CCNet.Core.Util.IoService(); ios.DeleteIncludingReadOnlyObjects(workingDirectory); System.IO.Directory.CreateDirectory(workingDirectory); System.IO.File.Delete(ProjectStateFile); string NantBuildFile = @"IntegrationScenarios\Nant.Build"; var NantExeLocation = ""; #if DEBUG NantExeLocation = @"..\..\..\..\Tools\Nant\nant.exe"; #else NantExeLocation = @"..\..\Tools\Nant\nant.exe"; #endif var configFileData = System.IO.File.ReadAllText(CCNetConfigFile); configFileData = configFileData.Replace("WillBeReplacedViaTheTest", NantExeLocation); System.IO.File.WriteAllText(CCNetConfigFile, configFileData); System.IO.File.Copy(NantBuildFile, System.IO.Path.Combine(workingDirectory, new System.IO.FileInfo(NantBuildFile).Name)); IntegrationCompleted.Add(ProjectName1, false); Log("Clear existing state file, to simulate first run : " + ProjectStateFile); System.IO.File.Delete(ProjectStateFile); Log("Clear integration folder to simulate first run"); if (System.IO.Directory.Exists(IntegrationFolder)) System.IO.Directory.Delete(IntegrationFolder, true); string FailureFileLocation = System.IO.Path.Combine(workingDirectory, "FailBuild.txt"); Log("Creating failure file so the build will fail the nant task"); var ff = new System.IO.FileStream(FailureFileLocation, System.IO.FileMode.CreateNew); ff.Close(); ff.Dispose(); CCNet.Remote.Messages.ProjectStatusResponse psr; CCNet.Remote.Messages.ProjectRequest pr1 = new CCNet.Remote.Messages.ProjectRequest(null, ProjectName1); Log("Making CruiseServerFactory"); CCNet.Core.CruiseServerFactory csf = new CCNet.Core.CruiseServerFactory(); Log("Making cruiseServer with config from :" + CCNetConfigFile); using (var cruiseServer = csf.Create(true, CCNetConfigFile)) { // subscribe to integration complete to be able to wait for completion of a build cruiseServer.IntegrationCompleted += new EventHandler<ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("Starting cruiseServer"); cruiseServer.Start(); System.Threading.Thread.Sleep(250); // give time to start Log("Forcing build to fail the build"); CheckResponse(cruiseServer.ForceBuild(pr1)); System.Threading.Thread.Sleep(250); // give time to start the build Log("Waiting for integration to complete"); while (!IntegrationCompleted[ProjectName1]) { for (int i = 1; i <= 4; i++) System.Threading.Thread.Sleep(250); Log(" waiting ..."); } Log("Forcing build so it will pass now"); IntegrationCompleted[ProjectName1] = false; System.IO.File.Delete(FailureFileLocation); CheckResponse(cruiseServer.ForceBuild(pr1)); System.Threading.Thread.Sleep(250); // give time to start the build Log("Waiting for integration to complete"); while (!IntegrationCompleted[ProjectName1]) { for (int i = 1; i <= 4; i++) System.Threading.Thread.Sleep(250); Log(" waiting ..."); } // un-subscribe to integration complete cruiseServer.IntegrationCompleted -= new EventHandler<ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("getting project status"); psr = cruiseServer.GetProjectStatus(pr1); CheckResponse(psr); Log("Stopping cruiseServer"); cruiseServer.Stop(); Log("waiting for cruiseServer to stop"); cruiseServer.WaitForExit(pr1); Log("cruiseServer stopped"); } Log("Checking the data"); CCNet.Remote.ProjectStatus ps = null; // checking data of project 1 foreach (var p in psr.Projects) { if (p.Name == ProjectName1) ps = p; } Assert.AreEqual(ProjectName1, ps.Name); Assert.AreEqual(CCNet.Remote.IntegrationStatus.Success, ps.BuildStatus, "wrong build state for project " + ProjectName1); }
public void PackagePublisherWithoutFlattenFiles() { const string ProjectName1 = "PackageTest02"; string IntegrationFolder = System.IO.Path.Combine("scenarioTests", ProjectName1); string CCNetConfigFile = System.IO.Path.Combine("IntegrationScenarios", "PackagePublisherTest02" + (Platform.IsWindows ? "" : "_linux") + ".xml"); string ProjectStateFile = new System.IO.FileInfo(ProjectName1 + ".state").FullName; IntegrationCompleted = new System.Collections.Generic.Dictionary <string, bool>(); string workingDirectory = "Packaging02"; string InfoFolder = "Info"; string subInfoFolder = "Sub1"; string FolderContainingFiles = string.Format("{0}{3}{1}{3}{2}", workingDirectory, InfoFolder, subInfoFolder, System.IO.Path.DirectorySeparatorChar); string f1 = string.Format("{0}{1}a.txt", FolderContainingFiles, System.IO.Path.DirectorySeparatorChar); string f2 = string.Format("{0}{1}b.txt", FolderContainingFiles, System.IO.Path.DirectorySeparatorChar); string f3 = string.Format("{0}{1}c.rtf", FolderContainingFiles, System.IO.Path.DirectorySeparatorChar); var ios = new CCNet.Core.Util.IoService(); ios.DeleteIncludingReadOnlyObjects(FolderContainingFiles); System.IO.Directory.CreateDirectory(FolderContainingFiles); System.IO.File.WriteAllText(f1, "somedata"); System.IO.File.WriteAllText(f2, "somedata"); IntegrationCompleted.Add(ProjectName1, false); Log("Clear existing state file, to simulate first run : " + ProjectStateFile); System.IO.File.Delete(ProjectStateFile); Log("Clear integration folder to simulate first run"); if (System.IO.Directory.Exists(IntegrationFolder)) { System.IO.Directory.Delete(IntegrationFolder, true); } CCNet.Remote.Messages.ProjectStatusResponse psr; CCNet.Remote.Messages.ProjectRequest pr1 = new CCNet.Remote.Messages.ProjectRequest(null, ProjectName1); Log("Making CruiseServerFactory"); CCNet.Core.CruiseServerFactory csf = new CCNet.Core.CruiseServerFactory(); Log("Making cruiseServer with config from :" + CCNetConfigFile); using (var cruiseServer = csf.Create(true, CCNetConfigFile)) { // subscribe to integration complete to be able to wait for completion of a build cruiseServer.IntegrationCompleted += new EventHandler <ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("Starting cruiseServer"); cruiseServer.Start(); System.Threading.Thread.Sleep(250); // give time to start Log("Forcing build"); CheckResponse(cruiseServer.ForceBuild(pr1)); System.Threading.Thread.Sleep(250); // give time to start the build Log("Waiting for integration to complete"); while (!IntegrationCompleted[ProjectName1]) { for (int i = 1; i <= 4; i++) { System.Threading.Thread.Sleep(250); } Log(" waiting ..."); } // un-subscribe to integration complete cruiseServer.IntegrationCompleted -= new EventHandler <ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("getting project status"); psr = cruiseServer.GetProjectStatus(pr1); CheckResponse(psr); Log("Stopping cruiseServer"); cruiseServer.Stop(); Log("waiting for cruiseServer to stop"); cruiseServer.WaitForExit(pr1); Log("cruiseServer stopped"); } Log("Checking the data"); string ExpectedZipFile = string.Format("{0}{1}Artifacts{1}1{1}TestPackage.zip", ProjectName1, System.IO.Path.DirectorySeparatorChar); Assert.IsTrue(System.IO.File.Exists(ExpectedZipFile), "zip package not found at expected location"); ICSharpCode.SharpZipLib.Zip.ZipFile zf = new ICSharpCode.SharpZipLib.Zip.ZipFile(ExpectedZipFile); List <string> actualFiles = new List <string>(); foreach (ICSharpCode.SharpZipLib.Zip.ZipEntry ze in zf) { System.Diagnostics.Debug.WriteLine(ze.Name); actualFiles.Add(ze.Name); } actualFiles.Sort(); Assert.AreEqual(@"Info/Sub1/a.txtInfo/Sub1/b.txt", String.Join("", actualFiles)); }
public void PackagePublisherPackageFolderMustRespectHierarchy() { const string ProjectName1 = "PackageTest03"; string IntegrationFolder = System.IO.Path.Combine("scenarioTests", ProjectName1); string CCNetConfigFile = System.IO.Path.Combine("IntegrationScenarios", "PackagePublisherTest03.xml"); string ProjectStateFile = new System.IO.FileInfo(ProjectName1 + ".state").FullName; IntegrationCompleted = new System.Collections.Generic.Dictionary<string, bool>(); string workingDirectory = "Packaging03"; string infoFolder = string.Format("{0}{1}some{1}directories{1}deeper{1}_PublishedWebsites{1}MyProject{1}", workingDirectory, System.IO.Path.DirectorySeparatorChar); string subInfoFolder = string.Format("{0}{1}AFolder{1}", infoFolder, System.IO.Path.DirectorySeparatorChar); string f1 = string.Format("{0}{1}a.txt", infoFolder, System.IO.Path.DirectorySeparatorChar); string f2 = string.Format("{0}{1}b.txt", subInfoFolder, System.IO.Path.DirectorySeparatorChar); var ios = new CCNet.Core.Util.IoService(); ios.DeleteIncludingReadOnlyObjects(infoFolder); ios.DeleteIncludingReadOnlyObjects("TheMegaWebSite"); System.IO.Directory.CreateDirectory(infoFolder); System.IO.Directory.CreateDirectory(subInfoFolder); System.IO.File.WriteAllText(f1, "somedata"); System.IO.File.WriteAllText(f2, "somedata"); IntegrationCompleted.Add(ProjectName1, false); Log("Clear existing state file, to simulate first run : " + ProjectStateFile); System.IO.File.Delete(ProjectStateFile); Log("Clear integration folder to simulate first run"); if (System.IO.Directory.Exists(IntegrationFolder)) System.IO.Directory.Delete(IntegrationFolder, true); CCNet.Remote.Messages.ProjectStatusResponse psr; CCNet.Remote.Messages.ProjectRequest pr1 = new CCNet.Remote.Messages.ProjectRequest(null, ProjectName1); Log("Making CruiseServerFactory"); CCNet.Core.CruiseServerFactory csf = new CCNet.Core.CruiseServerFactory(); Log("Making cruiseServer with config from :" + CCNetConfigFile); using (var cruiseServer = csf.Create(true, CCNetConfigFile)) { // subscribe to integration complete to be able to wait for completion of a build cruiseServer.IntegrationCompleted += new EventHandler<ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("Starting cruiseServer"); cruiseServer.Start(); System.Threading.Thread.Sleep(250); // give time to start Log("Forcing build"); CheckResponse(cruiseServer.ForceBuild(pr1)); System.Threading.Thread.Sleep(250); // give time to start the build Log("Waiting for integration to complete"); while (!IntegrationCompleted[ProjectName1]) { for (int i = 1; i <= 4; i++) System.Threading.Thread.Sleep(250); Log(" waiting ..."); } // un-subscribe to integration complete cruiseServer.IntegrationCompleted -= new EventHandler<ThoughtWorks.CruiseControl.Remote.Events.IntegrationCompletedEventArgs>(CruiseServerIntegrationCompleted); Log("getting project status"); psr = cruiseServer.GetProjectStatus(pr1); CheckResponse(psr); Log("Stopping cruiseServer"); cruiseServer.Stop(); Log("waiting for cruiseServer to stop"); cruiseServer.WaitForExit(pr1); Log("cruiseServer stopped"); } Log("Checking the data"); string ExpectedZipFile = string.Format("{0}{1}Artifacts{1}1{1}Project-package.zip", ProjectName1, System.IO.Path.DirectorySeparatorChar); Assert.IsTrue(System.IO.File.Exists(ExpectedZipFile), "zip package not found at expected location"); ICSharpCode.SharpZipLib.Zip.ZipFile zf = new ICSharpCode.SharpZipLib.Zip.ZipFile(ExpectedZipFile); string expectedFiles = string.Empty; foreach (ICSharpCode.SharpZipLib.Zip.ZipEntry ze in zf) { System.Diagnostics.Debug.WriteLine(ze.Name); expectedFiles += ze.Name; } Assert.AreEqual(@"MegaWebSite/AFolder/b.txtMegaWebSite/a.txt", expectedFiles); }