diff --git a/src/main/java/hudson/plugins/robot/RobotPublisher.java b/src/main/java/hudson/plugins/robot/RobotPublisher.java index 52995d6..905b9ec 100755 --- a/src/main/java/hudson/plugins/robot/RobotPublisher.java +++ b/src/main/java/hudson/plugins/robot/RobotPublisher.java @@ -36,6 +36,7 @@ import java.util.ArrayList; import java.util.Collection; +import javax.annotation.Nonnull; import javax.servlet.ServletException; import jenkins.tasks.SimpleBuildStep; @@ -249,7 +250,7 @@ protected RobotResult parse(String expandedTestResults, String expandedLogFileNa * {@inheritDoc} */ @Override - public void perform(Run build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException { + public void perform(Run build, @Nonnull FilePath workspace, @Nonnull EnvVars buildEnv, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException { if (build.getResult() != Result.ABORTED) { PrintStream logger = listener.getLogger(); logger.println(Messages.robot_publisher_started()); @@ -257,7 +258,6 @@ public void perform(Run build, FilePath workspace, Launcher launcher, Task RobotResult result; try { - EnvVars buildEnv = build.getEnvironment(listener); String expandedOutputFileName = buildEnv.expand(getOutputFileName()); String expandedOutputPath = buildEnv.expand(getOutputPath()); String expandedReportFileName = buildEnv.expand(getReportFileName()); @@ -265,9 +265,17 @@ public void perform(Run build, FilePath workspace, Launcher launcher, Task String logFileJavascripts = trimSuffix(expandedLogFileName) + ".js"; result = parse(expandedOutputFileName, expandedLogFileName, expandedReportFileName, expandedOutputPath, build, workspace, launcher, listener); - logger.println(Messages.robot_publisher_done()); + // Check if log and report files exist + FilePath outputDir = new FilePath(workspace, expandedOutputPath); + if (!new FilePath(outputDir, expandedLogFileName).exists()) { + logger.println(Messages.robot_publisher_file_not_found() + " " + expandedLogFileName); + } + if (!new FilePath(outputDir, expandedReportFileName).exists()) { + logger.println(Messages.robot_publisher_file_not_found() + " " + expandedReportFileName); + } + if (!DEFAULT_JENKINS_ARCHIVE_DIR.equalsIgnoreCase(getArchiveDirName())) { logger.println(Messages.robot_publisher_copying()); //Save configured Robot files (including split output) to build dir diff --git a/src/main/java/hudson/plugins/robot/RobotStepExecution.java b/src/main/java/hudson/plugins/robot/RobotStepExecution.java index 1b3cbe7..8553507 100644 --- a/src/main/java/hudson/plugins/robot/RobotStepExecution.java +++ b/src/main/java/hudson/plugins/robot/RobotStepExecution.java @@ -2,13 +2,12 @@ import java.util.logging.Logger; +import hudson.EnvVars; import org.jenkinsci.plugins.workflow.steps.StepContext; import org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution; import hudson.FilePath; import hudson.Launcher; -import hudson.matrix.MatrixBuild; -import hudson.model.BuildListener; import hudson.model.Run; import hudson.model.TaskListener; @@ -29,7 +28,7 @@ public class RobotStepExecution extends SynchronousNonBlockingStepExecution