提交 024b3353 编写于 作者: K kohsuke

another simple configuration round trip test case.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11724 71c3de6d-444a-0410-be80-ed276b4c234a
上级 9afcf286
package hudson.model;
import org.jvnet.hudson.test.HudsonTestCase;
import hudson.tasks.Shell;
import hudson.tasks.Builder;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlButton;
import java.util.List;
/**
* @author Kohsuke Kawaguchi
*/
public class FreeStyleProjectTest extends HudsonTestCase {
/**
* Tests a trivial configuration round-trip.
*
* The goal is to catch a P1-level issue that prevents all the form submissions to fail.
*/
public void testConfigSubmission() throws Exception {
FreeStyleProject project = createFreeStyleProject();
Shell shell = new Shell("echo hello");
project.getBuildersList().add(shell);
// emulate the user behavior
WebClient webClient = new WebClient();
HtmlPage page = webClient.getPage(project,"configure");
HtmlForm form = page.getFormByName("config");
form.submit((HtmlButton)last(form.getHtmlElementsByTagName("button")));
List<Builder> builders = project.getBuilders();
assertEquals(1,builders.size());
assertEquals(Shell.class,builders.get(0).getClass());
assertEquals("echo hello",((Shell)builders.get(0)).getCommand());
assertTrue(builders.get(0)!=shell);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册