mirror of
https://github.com/firstBitMarksistskaya/jenkins-lib.git
synced 2024-12-04 10:34:42 +02:00
Упрощение сборки данных дымовых тестов
This commit is contained in:
parent
df0c3f364d
commit
b8af950896
@ -6,6 +6,7 @@ import ru.pulsar.jenkins.library.configuration.JobConfiguration
|
||||
import ru.pulsar.jenkins.library.ioc.ContextRegistry
|
||||
import ru.pulsar.jenkins.library.utils.FileUtils
|
||||
import ru.pulsar.jenkins.library.utils.Logger
|
||||
import ru.pulsar.jenkins.library.utils.StringJoiner
|
||||
import ru.pulsar.jenkins.library.utils.VRunner
|
||||
|
||||
class SmokeTest implements Serializable {
|
||||
@ -61,14 +62,14 @@ class SmokeTest implements Serializable {
|
||||
FilePath pathToAllureReport = FileUtils.getFilePath("$env.WORKSPACE/$allureReport")
|
||||
String allureReportDir = FileUtils.getLocalPath(pathToAllureReport.getParent())
|
||||
|
||||
StringBuilder reportsConfigConstructor = new StringBuilder()
|
||||
StringJoiner reportsConfigConstructor = new StringJoiner(";")
|
||||
|
||||
if (options.publishToJUnitReport) {
|
||||
steps.createDir(junitReportDir)
|
||||
|
||||
String junitReportCommand = "ГенераторОтчетаJUnitXML{$junitReport}"
|
||||
|
||||
reportsConfigConstructor.append(junitReportCommand)
|
||||
reportsConfigConstructor.add(junitReportCommand)
|
||||
}
|
||||
|
||||
if (options.publishToAllureReport) {
|
||||
@ -76,10 +77,7 @@ class SmokeTest implements Serializable {
|
||||
|
||||
String allureReportCommand = "ГенераторОтчетаAllureXMLВерсия2{$allureReport}"
|
||||
|
||||
if (reportsConfigConstructor.length() > 0) {
|
||||
reportsConfigConstructor.append(';')
|
||||
}
|
||||
reportsConfigConstructor.append(allureReportCommand)
|
||||
reportsConfigConstructor.add(allureReportCommand)
|
||||
}
|
||||
|
||||
if (reportsConfigConstructor.length() > 0) {
|
||||
|
37
src/ru/pulsar/jenkins/library/utils/StringJoiner.groovy
Normal file
37
src/ru/pulsar/jenkins/library/utils/StringJoiner.groovy
Normal file
@ -0,0 +1,37 @@
|
||||
package ru.pulsar.jenkins.library.utils
|
||||
|
||||
class StringJoiner implements Serializable {
|
||||
private final String delimiter
|
||||
private StringBuilder value
|
||||
|
||||
StringJoiner(CharSequence delimiter) {
|
||||
this.delimiter = delimiter
|
||||
}
|
||||
|
||||
StringJoiner add(CharSequence newElement) {
|
||||
prepareBuilder().append(newElement)
|
||||
return this
|
||||
}
|
||||
|
||||
int length() {
|
||||
return (value != null ? value.length() : 0)
|
||||
}
|
||||
|
||||
@Override
|
||||
String toString() {
|
||||
if (value == null) {
|
||||
return ""
|
||||
} else {
|
||||
return value.toString()
|
||||
}
|
||||
}
|
||||
|
||||
private StringBuilder prepareBuilder() {
|
||||
if (value != null) {
|
||||
value.append(delimiter)
|
||||
} else {
|
||||
value = new StringBuilder()
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user