Skip to content
Permalink
Browse files

[JENKINS-37815] Add a test for buildWithParameters

  • Loading branch information
ikedam committed Sep 8, 2016
1 parent 101d1cc commit a4f8594bfa65e90892f9e0cd32ecb405b2ff6544
@@ -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;
@@ -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.
You can’t perform that action at this time.