为您回答问题有点晚,但可能对其他人有帮助。. .
我认为最适合这种情况的两件事很简单:
没有一种简单的方法可以使跳过的测试更加突出。
但是您可以对测试结果进行一些后处理。
我们在作业脚本/测试脚本中生成一个 VERSION.txt 文件并将其放入作业工作区。然后我们使用 Groovy Postbuild 操作并设置作业描述:
“Groovy 后期构建”
def currentBuild = Thread.currentThread().executable
def ws = manager.build.workspace.getRemote()
String desc = new File(ws + "/VERSION.txt").text
currentBuild.setDescription(desc)
这非常有用,我们可以在作业历史记录中查看测试的版本或其他详细信息。
把东西标记得更显眼。. . >;) 你可以使用徽章和一些时髦的东西。
使用的插件:
https://wiki.jenkins.io/display/JENKINS/Groovy+Postbuild+Plugin
Groovy Postbuild 插件是唯一真正需要的插件。Badges API 是 Groovy Postbuild 插件的一部分。
https://wiki.jenkins.io/display/JENKINS/Groovy+plugin
Groovy 插件对于试验 groovy 或使用 groovy 制作工作很有用。
https://wiki.jenkins.io/display/JENKINS/Build+Trigger+Badge+Plugin
实际上,徽章在 jenkins groovy postbuild 插件中可用。如果使用各种触发器但实际上不需要设置徽章,我使用的 BuildTriggerBadge 插件仍然很有用。我在安装时将其包含在此处,但我不能 100% 确定没有它我的代码是否可以正常工作(但我可能 98.5% 确定)。我没有安装徽章插件。
请参阅下面的一些带有徽章的常规实验:
def currentBuild = Thread.currentThread().executable
def ws = manager.build.workspace.getRemote()
String desc = new File(ws + "/VERSION.txt").text
currentBuild.setDescription(desc)
if (desc.contains("ERROR")) {
coverageText="VarkeninK, SomethinK iz bad."
// Apologies :-7 I can only assume this was from Viktor in http://www.userfriendly.org/ web comic
manager.addShortText(coverageText, "black", "repeating-linear-gradient(45deg,
yellow, yellow 10px, Orange 10px, Orange 20px)", "0px", "white")
}
manager.addShortText("GreyWhite0pxWhite", "grey", "white", "0px", "white")
manager.addShortText("BlackGreen0pxWhite", "black", "green", "0px", "white")
manager.addShortText("BlackGreen5pxWhite", "black", "green", "5px", "white")
manager.addShortText("VERSION WhiteGreen0pxWhite", "white", "green", "0px", "white")
manager.addShortText("WhiteGreen5pxWhite", "white", "green", "5px", "white")
manager.addShortText("VERSION Black on Lime Green", "black", "limegreen", "0px", "white")
// darkgrey is lighter than grey!! :-P
manager.addShortText("OBSOLETE YellowDarkGrey5pxGrey", "yellow", "darkgrey", "5px", "grey")
manager.addShortText("OBSOLETE YellowGrey5pxGrey", "yellow", "grey", "5px", "grey")
manager.removeBadges()
manager.addShortText("VERSION Black on Lime Green", "black", "limegreen", "0px", "white")
manager.addShortText(desc, "black", "limegreen", "5px", "white")
manager.addShortText("OBSOLETE YellowGrey5pxGrey", "yellow", "grey", "5px", "grey")
manager.addBadge("warning.gif", "Warning test")
manager.addWarningBadge("other warning test")
// https://wiki.jenkins.io/display/JENKINS/Groovy+Postbuild+Plugin
// contains(file, regexp) - returns true if the given file contains a line matching regexp.
// logContains(regexp) - returns true if the build log file contains a line matching regexp.
// getMatcher(file, regexp) - returns a java.util.regex.Matcher for the first occurrence of regexp in the given file.
// getLogMatcher(regexp) - returns a java.util.regex.Matcher for the first occurrence of regexp in the build log file.
// setBuildNumber(number) - sets the build with the given number as current build. The current build is the target of all methods that add or remove badges and summaries or change the build result.
// addShortText(text) - puts a badge with a short text, using the default format.
// addShortText(text, color, background, border, borderColor) - puts a badge with a short text, using the specified format.
// addBadge(icon, text) - puts a badge with the given icon and text. In addition to the 16x16 icons offered by Jenkins, groovy-postbuild provides the following icons:
// - completed.gif
// - db_in.gif
// - db_out.gif
// - delete.gif
// - error.gif
// - folder.gif
// - green.gif
// - info.gif
// - red.gif
// - save.gif
// - success.gif
// - text.gif
// - warning.gif
// - yellow.gif
// addBadge(icon, text, link) - like addBadge(icon, text), but the Badge icon then actually links to the given link (since 1.8)
// addInfoBadge(text) - puts a badge with info icon and the given text.
// addWarningBadge(text) - puts a badge with warning icon and the given text.
// addErrorBadge(text) - puts a badge with error icon and the given text.
// removeBadges() - removes all badges from the current build.
// removeBadge(index) - removes the badge with the given index.
// createSummary(icon) - creates an entry in the build summary page and returns a summary object corresponding to this entry. The icon must be one of the 48x48 icons offered by Jenkins. You can append text to the summary object by calling its appendText methods:
// appendText(text, escapeHtml)
// appendText(text, escapeHtml, bold, italic, color)
// removeSummaries() - removes all summaries from the current build.
// removeSummary(index) - removes the summary with the given index.
// buildUnstable() - sets the build result to UNSTABLE.
// buildFailure() - sets the build result to FAILURE.
// buildSuccess() - sets the build result to SUCCESS.