Skip to content

Commit

Permalink
[JENKINS-37815] Add a test for buildWithParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ikedam committed Sep 8, 2016
1 parent 101d1cc commit a4f8594
Showing 1 changed file with 27 additions and 0 deletions.
Expand Up @@ -26,6 +26,8 @@

import static org.junit.Assert.*;

import java.net.URLEncoder;

import hudson.cli.CLI;
import hudson.matrix.AxisList;
import hudson.matrix.Combination;
Expand Down Expand Up @@ -589,4 +591,29 @@ public void testCliBuild() throws Exception {
assertNull(b.getExactRun(new Combination(axes, "value2")));
assertNotNull(b.getExactRun(new Combination(axes, "value3")));
}

@Test
public void testBuildWithParameters() throws Exception {
AxisList axes = new AxisList(new TextAxis("axis1", "value1", "value2", "value3"));
MatrixProject p = j.createMatrixProject();
p.setAxes(axes);
p.addProperty(new ParametersDefinitionProperty(
new MatrixCombinationsParameterDefinition("combinations", "", "")
));

WebClient wc = j.createWebClient();
wc.getPage(p, String.format(
"/buildWithParameters?combinations=%s",
URLEncoder.encode("axis1 in ['value1', 'value3']", "UTF-8")
));

j.waitUntilNoActivity();

MatrixBuild b = p.getLastBuild();
j.assertBuildStatusSuccess(b);

assertNotNull(b.getExactRun(new Combination(axes, "value1")));
assertNull(b.getExactRun(new Combination(axes, "value2")));
assertNotNull(b.getExactRun(new Combination(axes, "value3")));
}
}

0 comments on commit a4f8594

Please sign in to comment.