HtmlForm form = p.getFormByName("postCredential");
form.getInputByName("username").setValueAttribute("foo");
form.getInputByName("password").setValueAttribute("bar");
form.submit(null);
DescriptorImpl d = jenkins.getDescriptorByType(DescriptorImpl.class);
assertEquals("foo",d.getUsername());
assertEquals("bar",d.getPassword().getPlainText());
}