From b94e104a55cf17845e843e163f2459a0b2f5e05e Mon Sep 17 00:00:00 2001 From: Dima Ovcharenko Date: Tue, 30 Nov 2021 15:24:44 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BB=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8E=20=D0=BE=D1=82=D1=87=D0=B5=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=D0=B8=D1=87=D0=B8=D0=B8=20=D0=BD=D1=83=D0=B6?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D1=84=D0=BB=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/steps/SmokeTest.groovy | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/SmokeTest.groovy b/src/ru/pulsar/jenkins/library/steps/SmokeTest.groovy index 116fedb..abe1dad 100644 --- a/src/ru/pulsar/jenkins/library/steps/SmokeTest.groovy +++ b/src/ru/pulsar/jenkins/library/steps/SmokeTest.groovy @@ -54,19 +54,40 @@ class SmokeTest implements Serializable { command += " --xddConfig $xddConfigPath" } - String junitReport = "build/out/jUnit/smoke/smoke.xml" - FilePath pathToJUnitReport = FileUtils.getFilePath("$env.WORKSPACE/$junitReport") - String junitReportDir = FileUtils.getLocalPath(pathToJUnitReport.getParent()) + if (options.publishToAllureReport || options.publishToJUnitReport) { + + command += " --reportsxunit \"%REPORTS%\"" - steps.createDir(junitReportDir) + String allureReportCommand = "" + if (options.publishToAllureReport) { - String allureReport = "build/out/allure/smoke/allure.xml" - FilePath pathToAllureReport = FileUtils.getFilePath("$env.WORKSPACE/$allureReport") - String allureReportDir = FileUtils.getLocalPath(pathToAllureReport.getParent()) + String allureReport = "build/out/allure/smoke/allure.xml" + FilePath pathToAllureReport = FileUtils.getFilePath("$env.WORKSPACE/$allureReport") + String allureReportDir = FileUtils.getLocalPath(pathToAllureReport.getParent()) - steps.createDir(allureReportDir) + steps.createDir(allureReportDir) - command += " --reportsxunit \"ГенераторОтчетаJUnitXML{$junitReport};ГенераторОтчетаAllureXMLВерсия2{$allureReport}\"" + allureReportCommand = "ГенераторОтчетаAllureXMLВерсия2{$allureReport}" + + } + + String junitReportCommand = "" + if (options.publishToJUnitReport) { + + String junitReport = "build/out/jUnit/smoke/smoke.xml" + FilePath pathToJUnitReport = FileUtils.getFilePath("$env.WORKSPACE/$junitReport") + String junitReportDir = FileUtils.getLocalPath(pathToJUnitReport.getParent()) + + steps.createDir(junitReportDir) + + junitReportCommand = "ГенераторОтчетаJUnitXML{$junitReport}" + } + + def commandsList = [allureReportCommand, junitReportCommand] + commandsList.removeAll([""]) + def reportsCommand = commandsList.join(";") + command.replace("%REPORTS%", reportsCommand) + } if (steps.isUnix()) { command = command.replace(';', '\\;') }