use of org.evosuite.jenkins.actions.BuildAction in project evosuite by EvoSuite.
the class EvoSuiteRecorder method perform.
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
if (build.getResult().isWorseThan(Result.SUCCESS)) {
listener.getLogger().println(EvoSuiteRecorder.LOG_PREFIX + "Build did not succeed, so no test case generation by EvoSuite will occur.");
return true;
}
AbstractMavenProject<?, ?> project = ((AbstractMavenProject<?, ?>) build.getProject());
ProjectAction projectAction = new ProjectAction(project);
projectAction.perform(project, build, listener);
BuildAction build_action = new BuildAction(build, projectAction);
build.addAction(build_action);
if (this.disableAutoCommit) {
return true;
}
SCM scm = project.getScm();
if (scm == null) {
listener.getLogger().println(EvoSuiteRecorder.LOG_PREFIX + "Project '" + project.getName() + "' has no Source-Control-Management (SCM) defined.");
return true;
}
org.evosuite.jenkins.scm.SCM scmWrapper = null;
if (scm instanceof MercurialSCM) {
scmWrapper = new Mercurial((MercurialSCM) scm, project, build, launcher, listener);
} else if (scm instanceof GitSCM) {
scmWrapper = new Git((GitSCM) scm, build, listener);
} else {
listener.getLogger().println(EvoSuiteRecorder.LOG_PREFIX + "SCM of type " + scm.getType() + " not supported!");
return true;
}
assert scmWrapper != null;
// perform commit action
int number_of_files_committed = scmWrapper.commit(project, build, listener, this.branchName, this.ctgBestsDir);
if (number_of_files_committed == -1) {
return false;
}
if (!this.disableAutoPush && number_of_files_committed > 0) {
if (!scmWrapper.push(build, listener, this.branchName)) {
return false;
}
}
return true;
}
use of org.evosuite.jenkins.actions.BuildAction in project evosuite by EvoSuite.
the class TimePlot method doStats.
private CategoryDataset doStats() {
DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel> timeDataSetBuilder = new DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel>();
for (Run<?, ?> build : this.project.getProject().getBuilds()) {
final BuildAction build_action = build.getAction(BuildAction.class);
if (build_action == null) {
// no build action is associated with this build, so skip it
continue;
}
int timeBudget = build_action.getProjectAction().getTimeBudget();
timeDataSetBuilder.add(timeBudget, "Total Time Budget", new ChartUtil.NumberOnlyBuildLabel(build));
int totalEffort = build_action.getProjectAction().getTotalEffort();
timeDataSetBuilder.add(totalEffort, "Time Budget Used", new ChartUtil.NumberOnlyBuildLabel(build));
}
return timeDataSetBuilder.build();
}
use of org.evosuite.jenkins.actions.BuildAction in project evosuite by EvoSuite.
the class CoveragePlot method doStats.
private CategoryDataset doStats() {
DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel> coverageDataSetBuilder = new DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel>();
for (Run<?, ?> build : this.project.getProject().getBuilds()) {
final BuildAction build_action = build.getAction(BuildAction.class);
if (build_action == null) {
// no build action is associated with this build, so skip it
continue;
}
Set<String> criteria = build_action.getProjectAction().getCriteria();
for (String criterion : criteria) {
double coverage = build_action.getProjectAction().getCriterionCoverage(criterion);
coverageDataSetBuilder.add(coverage, criterion, new ChartUtil.NumberOnlyBuildLabel(build));
}
}
return coverageDataSetBuilder.build();
}
Aggregations