表单验证和提交(java测试用例)

发布于 2024-12-22 06:52:19 字数 332 浏览 3 评论 0 原文

我正在为一个小问题而苦苦挣扎。这是我的设置:

  • 简单的 JSF 2.x xhtml 页面,具有简单的形式
    • 用于登录名和密码的托管 Bean
    • 与提交按钮的“操作”绑定的托管 bean
    • 自定义验证器
  • java 测试用例

我想触发(来自测试用例)表单提交,以便触发验证器并托管绑定到“的方法”提交按钮的“action”属性。

这可能吗?我用谷歌搜索了一下并尝试了一些东西,但仍然无法触发验证。

我可能无法正确处理 POST 请求或在已部署的 Web 应用程序中设置某些内容?

I'm struggling with a small problem. Here is my setup:

  • simple JSF 2.x xhtml page, with simple form
    • managed bean for login name and password
    • managed bean tied to "action" of submit button
    • custom validator
  • java test case

I want to trigger( from test case ) form submission, in order to trigger validator and managed been method tied to "action" attribute of submit button.

Is this even possible? Ive googled a bit and tried few things, but still fail to trigger validation.

Possibly Im failing to address POST request properly or to setup something in deployed web app?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月静好 2024-12-29 06:52:20

是的,很有可能。

  • 部署应用程序
  • 使用 Selenium 并尝试在设置错误数据后单击按钮
  • 读取响应(使用 Selenium)并解析错误预期DIV中的消息

参见

Yes possible very well.

  • Deploy application
  • Use Selenium and try to click on the button after setting wrong data
  • Read the response (using Selenium) and parse the error message in expected DIV

See

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文