Skip to content

Commit

Permalink
[FIXED HUDSON-4449] - Fixed so skipped tests are ignored.
Browse files Browse the repository at this point in the history
  • Loading branch information
redsolo committed Sep 14, 2009
1 parent 9711296 commit d40d56b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Expand Up @@ -30,8 +30,8 @@ public RuleResult evaluate(AbstractBuild<?, ?> build) {
if ((action != null) && (action.getPreviousResult() != null)) {
return evaluate(build.getResult(),
build.getPreviousBuild().getResult(),
action.getTotalCount()-action.getFailCount(),
action.getPreviousResult().getTotalCount()-action.getPreviousResult().getFailCount());
action.getTotalCount()-action.getFailCount() - action.getSkipCount(),
action.getPreviousResult().getTotalCount()-action.getPreviousResult().getFailCount() - action.getPreviousResult().getSkipCount());
}
}
return null;
Expand Down
Expand Up @@ -14,6 +14,7 @@

import org.junit.Assert;
import org.junit.Test;
import org.jvnet.hudson.test.Bug;

@SuppressWarnings("unchecked")
public class IncreasingPassedTestsRuleTest {
Expand Down Expand Up @@ -89,4 +90,26 @@ public void assertResultIsCalculated() {
assertThat(ruleResult, notNullValue());
assertThat(ruleResult.getPoints(), is(500d));
}

@Bug(4449)
@Test
public void assertSkippedTestIsntCalculated() {
AbstractBuild build = mock(AbstractBuild.class);
AbstractBuild previousBuild = mock(AbstractBuild.class);
when(build.getPreviousBuild()).thenReturn(previousBuild);
when(build.getResult()).thenReturn(Result.SUCCESS);
when(previousBuild.getResult()).thenReturn(Result.SUCCESS);
AbstractTestResultAction action = mock(AbstractTestResultAction.class);
AbstractTestResultAction previousAction = mock(AbstractTestResultAction.class);
when(build.getActions(AbstractTestResultAction.class)).thenReturn(Arrays.asList(action));
when(action.getPreviousResult()).thenReturn(previousAction);
when(action.getTotalCount()).thenReturn(10);
when(action.getSkipCount()).thenReturn(5);
when(previousAction.getTotalCount()).thenReturn(5);
when(previousAction.getSkipCount()).thenReturn(1);

RuleResult ruleResult = new IncreasingPassedTestsRule(100).evaluate(build);
assertThat(ruleResult, notNullValue());
assertThat(ruleResult.getPoints(), is(100d));
}
}

0 comments on commit d40d56b

Please sign in to comment.