Der Reference Job hat nichts mit dem Bauen zu tun, das muss im Recorder gesetzt werden.
Das Setzen können Sie analog zu einem der bestehenden Tests machen. Diese Parameter im Test am einfachsten als Lambda übergeben (siehe publisher Variable unten):
/**
* Sets the UNSTABLE threshold to 8 and parse a file that contains exactly 8 warnings: the build should be unstable.
*/
@Test
public void shouldCreateUnstableResult() {
FreeStyleProject project = createJobWithWorkspaceFile("eclipse.txt");
enableWarnings(project, publisher -> publisher.setUnstableTotalAll(7));
AnalysisResult result = scheduleBuildAndAssertStatus(project, Result.UNSTABLE);
assertThat(result).hasTotalSize(8);
assertThat(result).hasStatus(Status.WARNING);
HtmlPage page = getWebPage(result);
assertThat(page.getElementsByIdAndOrName("statistics")).hasSize(1);
}
Welche Setter Sie Nutzen können, sehen Sie in der Klasse IssuesRecorder.
Folgende drei Setter sind verfügbar:
/**
* If {@code true} then the result of the previous analysis run is ignored when searching for the reference,
* otherwise the result of the static analysis reference must be {@link Result#SUCCESS}.
*
* @param ignoreAnalysisResult
* if {@code true} then the previous build is always used
*/
@DataBoundSetter
public void setIgnoreAnalysisResult(final boolean ignoreAnalysisResult) {
this.ignoreAnalysisResult = ignoreAnalysisResult;
}
/**
* If {@code true} then only runs with an overall result of {@link Result#SUCCESS} are considered as a reference,
* otherwise every run that contains results of the same static analysis configuration is considered.
*
* @param overallResultMustBeSuccess
* if {@code true} then a stable build is used as reference
*/
@DataBoundSetter
public void setOverallResultMustBeSuccess(final boolean overallResultMustBeSuccess) {
this.overallResultMustBeSuccess = overallResultMustBeSuccess;
}
/**
* Sets the reference job to get the results for the issue difference computation.
*
* @param referenceJobName
* the name of reference job
*/
@DataBoundSetter
public void setReferenceJobName(final String referenceJobName) {
if (NO_REFERENCE_JOB.equals(referenceJobName)) {
this.referenceJobName = StringUtils.EMPTY;
}
this.referenceJobName = referenceJobName;
}
Testfälle, die mir spontan eingefallen sind in die Description hinzugefügt.