You've already forked jenkins-lib
forked from jenkins/jenkins-lib
реализовал генерацию отчетов только при наличии нужных флагов
This commit is contained in:
@@ -54,19 +54,40 @@ class SmokeTest implements Serializable {
|
|||||||
command += " --xddConfig $xddConfigPath"
|
command += " --xddConfig $xddConfigPath"
|
||||||
}
|
}
|
||||||
|
|
||||||
String junitReport = "build/out/jUnit/smoke/smoke.xml"
|
if (options.publishToAllureReport || options.publishToJUnitReport) {
|
||||||
FilePath pathToJUnitReport = FileUtils.getFilePath("$env.WORKSPACE/$junitReport")
|
|
||||||
String junitReportDir = FileUtils.getLocalPath(pathToJUnitReport.getParent())
|
command += " --reportsxunit \"%REPORTS%\""
|
||||||
|
|
||||||
steps.createDir(junitReportDir)
|
String allureReportCommand = ""
|
||||||
|
if (options.publishToAllureReport) {
|
||||||
|
|
||||||
String allureReport = "build/out/allure/smoke/allure.xml"
|
String allureReport = "build/out/allure/smoke/allure.xml"
|
||||||
FilePath pathToAllureReport = FileUtils.getFilePath("$env.WORKSPACE/$allureReport")
|
FilePath pathToAllureReport = FileUtils.getFilePath("$env.WORKSPACE/$allureReport")
|
||||||
String allureReportDir = FileUtils.getLocalPath(pathToAllureReport.getParent())
|
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()) {
|
if (steps.isUnix()) {
|
||||||
command = command.replace(';', '\\;')
|
command = command.replace(';', '\\;')
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user