如何为Primefaces / JSF应用程序编写单元测试

时间:2015-04-20 22:55:05

标签: java jsf jsf-2 primefaces junit

有没有人知道我可以为Primefaces或其他基于JSF的Web应用程序编写Java单元测试的简单方法?我在Primefaces'创作者:

https://cagataycivici.wordpress.com/2009/09/08/easy-unit-testing-jsf-backing-beans/

...但是从2009年开始,建议将Java与MockitoJUnit一起使用。我不确定单元测试编码是否有任何新的进展,因为那时候使Primefaces的单元测试变得更加容易。

其他消息来源建议将Java与JSFUnit一起使用,看起来它有一些问题,并且我自己设置起来并不直观。

感谢您的回复。

1 个答案:

答案 0 :(得分:2)

您可以尝试Selenium

Selenium客户端API:
作为在Selenese中编写测试的替代方法,测试也可以用各种编程语言编写。然后,这些测试通过调用Selenium Client API中的方法与Selenium进行通信。 Selenium目前为Java,C#,Ruby和Python提供客户端API。 Read More...

示例:
Testing JSF applications with Arquillian and Selenium
Java testing with Selenium and dynamic ids in html