public void BuildTest() { JenkinsModelFreeStyleBuild freeStyleBuild = null; //JenkinsBuildExternal externalBuild = null; JenkinsMatrixMatrixBuild matrixBuild = null; JenkinsOrgJenkinsciPluginsWorkflowJobWorkflowRun workflowBuild = null; //JenkinsBuildWorkflowMultiBranch multiBranchBuild = null; //JenkinsBuildFolder folderBuild = null; //JenkinsBuildOrganizationFolder organizationFolderBuild = null; using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleBuild = jenkins.GetLastBuildAsync("Freestyle Test Pure").Result as JenkinsModelFreeStyleBuild; //externalBuild = jenkins.GetBuildAsync("External Job", 1).Result as JenkinsBuildExternal; matrixBuild = jenkins.GetBuildAsync("Multiconfiguration", 1).Result as JenkinsMatrixMatrixBuild; workflowBuild = jenkins.GetBuildAsync("Pipeline", 1).Result as JenkinsOrgJenkinsciPluginsWorkflowJobWorkflowRun; //multiBranchBuild = jenkins.GetBuildAsync("Multibranch", 1).Result as JenkinsBuildWorkflowMultiBranch; //folderBuild = jenkins.GetBuildAsync("Folder", 1).Result as JenkinsBuildFolder; //organizationFolderBuild = jenkins.GetBuildAsync("GitHub", 1).Result as JenkinsBuildOrganizationFolder; } Assert.IsNotNull(freeStyleBuild); //Assert.IsNotNull(externalBuild); Assert.IsNotNull(matrixBuild); //Assert.IsNotNull(workflowBuild); //Assert.IsNotNull(multiBranchBuild); //Assert.IsNotNull(folderBuild); //Assert.IsNotNull(organizationFolderBuild); }
public void BuildGetGenericTest() { // Arrange JenkinsModelFreeStyleBuild freeStyleBuild = null; //JenkinsBuildExternal externalBuild = null; JenkinsMatrixMatrixBuild matrixBuild = null; JenkinsJenkinsciWorkflowRun workflowBuild = null; //JenkinsBuildWorkflowMultiBranch multiBranchBuild = null; //JenkinsBuildFolder folderBuild = null; //JenkinsBuildOrganizationFolder organizationFolderBuild = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleBuild = jenkins.GetLastBuildAsync <JenkinsModelFreeStyleBuild>("Freestyle").Result; //externalBuild = jenkins.GetBuildAsync("ExternalJob", 1).Result as JenkinsBuildExternal; matrixBuild = jenkins.GetBuildAsync <JenkinsMatrixMatrixBuild>("Multiconfiguration", 1).Result; workflowBuild = jenkins.GetBuildAsync <JenkinsJenkinsciWorkflowRun>("Pipeline", 1).Result; //multiBranchBuild = jenkins.GetBuildAsync("MultibranchPipeline", 1).Result as JenkinsBuildWorkflowMultiBranch; //folderBuild = jenkins.GetBuildAsync("Folder", 1).Result as JenkinsBuildFolder; //organizationFolderBuild = jenkins.GetBuildAsync("GitHubOrganization", 1).Result as JenkinsBuildOrganizationFolder; } // Assert Assert.IsNotNull(freeStyleBuild); //Assert.IsNotNull(externalBuild); Assert.IsNotNull(matrixBuild); Assert.IsNotNull(workflowBuild); //Assert.IsNotNull(multiBranchBuild); //Assert.IsNotNull(folderBuild); //Assert.IsNotNull(organizationFolderBuild); }
public void BuildGraphTest() { // Arrange JenkinsModelFreeStyleBuild freeStyleBuild = null; JenkinsJenkinsciBuildGraph buildGraph = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleBuild = jenkins.GetLastBuildAsync <JenkinsModelFreeStyleBuild>("FreestyleTree").Result; buildGraph = jenkins.GetBuildGraph("FreestyleTree", freeStyleBuild.Number).Result; } // Assert Assert.IsNotNull(buildGraph, nameof(buildGraph)); Assert.IsNotNull(buildGraph.BuildGraph, nameof(buildGraph.BuildGraph)); }
public void BuildConsoleOutputTest() { // Arrange JenkinsModelFreeStyleBuild freeStyleBuild = null; string consoleOutput = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleBuild = jenkins.GetLastBuildAsync <JenkinsModelFreeStyleBuild>("FreeStyle").Result; consoleOutput = jenkins.GetBuildConsoleOutputAsync("FreeStyle", freeStyleBuild.Number, 0).Result; } // Assert Assert.IsNotNull(consoleOutput, nameof(consoleOutput)); StringAssert.StartsWith(consoleOutput, "Started by user Tester"); }
public void BuildSetInformationTest() { // Arrange JenkinsModelFreeStyleBuild freeStyleBuild = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleBuild = jenkins.GetLastBuildAsync <JenkinsModelFreeStyleBuild>("FreeStyle").Result; jenkins.SetBuildInformation("FreeStyle", freeStyleBuild.Number, "Build name", "Build description").Wait(); freeStyleBuild = jenkins.GetBuildAsync <JenkinsModelFreeStyleBuild>("FreeStyle", freeStyleBuild.Number).Result; jenkins.SetBuildInformation("FreeStyle", freeStyleBuild.Number, "", "").Wait(); } // Assert Assert.IsNotNull(freeStyleBuild, nameof(freeStyleBuild)); Assert.AreEqual("Build name", freeStyleBuild.DisplayName, nameof(freeStyleBuild.DisplayName)); Assert.AreEqual("Build description", freeStyleBuild.Description, nameof(freeStyleBuild.Description)); }
public void BuildEnvInjectVarListTest() { // Arrange JenkinsModelFreeStyleBuild freeStyleBuild = null; JenkinsJenkinsciEnvInjectVarList varList = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleBuild = jenkins.GetLastBuildAsync <JenkinsModelFreeStyleBuild>("FreeStyle").Result; varList = jenkins.GetEnvInjectVarListAsync("FreeStyle", freeStyleBuild.Number).Result; } // Assert Assert.IsNotNull(varList, nameof(varList)); var dict = varList.EnvMapDict; Assert.AreEqual("FreeStyle", dict["JOB_NAME"]); Assert.AreEqual(@"C:\Users\Public", dict["PUBLIC"]); }