hudson.tasks.test.AbstractTestResultAction Java Examples
The following examples show how to use
hudson.tasks.test.AbstractTestResultAction.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlakyTestResultAction.java From flaky-test-handler-plugin with Apache License 2.0 | 6 votes |
/** * Construct a FlakyTestResultAction object with Run and BuildListener * * @param build this build * @param listener listener of this build */ public FlakyTestResultAction(AbstractBuild build, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { this.build = build; // TODO consider the possibility that there is >1 such action AbstractTestResultAction action = build.getAction(AbstractTestResultAction.class); if (action != null) { Object latestResult = action.getResult(); if (latestResult != null && latestResult instanceof TestResult) { VirtualChannel channel = launcher.getChannel(); if(channel == null) { throw new InterruptedException("Could not get channel to run a program remotely."); } FlakyTestResult flakyTestResult = channel.call(new FlakyTestResultCollector((TestResult) latestResult)); flakyTestResult.freeze(action, build); FlakyRunStats stats = new FlakyRunStats(flakyTestResult.getTestFlakyStatsMap()); setFlakyRunStats(stats, listener); } } else { logger.log(Level.WARNING, "No test result found, please publish junit report first"); } }
Example #2
Source File: BitbucketBuildStatusHelper.java From bitbucket-build-status-notifier-plugin with MIT License | 5 votes |
public static String defaultBitbucketBuildDescriptionFromBuild(Run<?, ?> build) { AbstractTestResultAction testResult = build.getAction(AbstractTestResultAction.class); String description = ""; if (testResult != null) { int passedCount = testResult.getTotalCount() - testResult.getFailCount(); description = passedCount + " of " + testResult.getTotalCount() + " tests passed"; } return description; }
Example #3
Source File: ActiveNotifier.java From jenkins-mattermost-plugin with MIT License | 5 votes |
public MessageBuilder appendTestSummary() { AbstractTestResultAction<?> action = this.build.getAction(AbstractTestResultAction.class); if (action != null) { int total = action.getTotalCount(); int failed = action.getFailCount(); int skipped = action.getSkipCount(); message.append("\nTest Status:\n"); message.append("\tPassed: " + (total - failed - skipped)); message.append(", Failed: " + failed); message.append(", Skipped: " + skipped); } else { message.append("\nNo Tests found."); } return this; }
Example #4
Source File: JUnitFlakyTestDataPublisher.java From flaky-test-handler-plugin with Apache License 2.0 | 5 votes |
@Override public TestResultAction.Data contributeTestData(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener, TestResult testResult) throws IOException, InterruptedException { VirtualChannel channel = launcher.getChannel(); if(channel == null) { throw new InterruptedException("Could not get channel to run a program remotely."); } FlakyTestResult flakyTestResult = channel.call(new FlakyTestResultCollector(testResult)); // TODO consider the possibility that there is >1 such action flakyTestResult.freeze(run.getAction(AbstractTestResultAction.class), run); return new JUnitFlakyTestData(flakyTestResult); }
Example #5
Source File: ZulipNotifierTest.java From zulip-plugin with MIT License | 5 votes |
@Test public void testUnstableBuild() throws Exception { ZulipNotifier notifier = new ZulipNotifier(); when(build.getResult()).thenReturn(Result.UNSTABLE); when(build.getAction(AbstractTestResultAction.class)).thenReturn(new FakeTestResultAction()); notifier.perform(build, null, buildListener); verify(zulip).sendStreamMessage(streamCaptor.capture(), topicCaptor.capture(), messageCaptor.capture()); assertEquals("Message should be unstable build", "**Project: **TestJob : **Build: **#1: **UNSTABLE** :warning: (50 broken tests)", messageCaptor.getValue()); }
Example #6
Source File: TestResult.java From junit-plugin with MIT License | 4 votes |
@Override public void setParentAction(AbstractTestResultAction action) { this.parentAction = action; tally(); // I want to be sure to inform our children when we get an action. }
Example #7
Source File: TestResult.java From junit-plugin with MIT License | 4 votes |
@Override public AbstractTestResultAction getParentAction() { return this.parentAction; }
Example #8
Source File: FlakyTestResult.java From flaky-test-handler-plugin with Apache License 2.0 | 4 votes |
@Override public void setParentAction(AbstractTestResultAction action) { this.parentAction = action; tally(); // I want to be sure to inform our children when we get an action. }
Example #9
Source File: FlakyTestResult.java From flaky-test-handler-plugin with Apache License 2.0 | 4 votes |
@Override public AbstractTestResultAction getParentAction() { return this.parentAction; }
Example #10
Source File: ZulipNotifier.java From zulip-plugin with MIT License | 4 votes |
private boolean publish(@Nonnull Run<?, ?> build, @Nonnull TaskListener listener) throws InterruptedException { if (shouldPublish(build)) { String configuredTopic = ZulipUtil.getDefaultValue(topic, DESCRIPTOR.getTopic()); Result result = getBuildResult(build); String changeString = ""; try { changeString = getChangeSet(build); } catch (Exception e) { logger.log(Level.WARNING, "Exception while computing changes since last build:\n" + ExceptionUtils.getStackTrace(e)); changeString += "\nError determining changes since last build - please contact [email protected]."; } String resultString = result.toString(); String message = ""; // If we are sending to fixed topic, we will want to add project name into the message if (ZulipUtil.isValueSet(configuredTopic)) { message += hundsonUrlMesssage("Project: ", build.getParent().getDisplayName(), build.getParent().getUrl(), DESCRIPTOR) + " : "; } message += hundsonUrlMesssage("Build: ", build.getDisplayName(), build.getUrl(), DESCRIPTOR); message += ": "; message += "**" + resultString + "**"; if (result == Result.SUCCESS) { message += " :check_mark:"; } else if (result == Result.UNSTABLE) { message += " :warning:"; AbstractTestResultAction testResultAction = build.getAction(AbstractTestResultAction.class); String failCount = testResultAction != null ? Integer.toString(testResultAction.getFailCount()) : "?"; message += " (" + failCount + " broken tests)"; } else { message += " :x:"; } if (changeString.length() > 0) { message += "\n\n"; message += changeString; } String destinationStream = ZulipUtil.expandVariables(build, listener, ZulipUtil.getDefaultValue(stream, DESCRIPTOR.getStream())); String destinationTopic = ZulipUtil.expandVariables(build, listener, ZulipUtil.getDefaultValue(configuredTopic, build.getParent().getDisplayName())); Zulip zulip = new Zulip(DESCRIPTOR.getUrl(), DESCRIPTOR.getEmail(), DESCRIPTOR.getApiKey()); zulip.sendStreamMessage(destinationStream, destinationTopic, message); } return true; }
Example #11
Source File: TestObject.java From junit-plugin with MIT License | votes |
public abstract AbstractTestResultAction getTestResultAction();