GWT Mockito和TestNG

时间:2015-08-04 11:59:29

标签: unit-testing gwt testng gwtmockito

如何使用GWT Mockito GWT Mockito与TestNG并行测试GWT方法?

编辑:2015年8月5日

我通过互联网搜索,我发现GWT Mockito仅用于Junit 4,我们公司使用TestNG作为标准,因此我们需要将GWT Mockito与TestNG集成以遵循公司的标准

1 个答案:

答案 0 :(得分:0)

I had the same issue, and wanted to test GWT using TestNG and Mockito.

After some research, I arranged a simple framework based on GWT Mockito and I called it "GWT Mockito NG": https://github.com/jiakuan/gwtmockito-ng

It can be used for testing GWT-platform presenters layer with TestNG, without Junit dependency. It's enough for testing GWT-platform presenters.

Another improvement I can see is to use Javassist to modify GWT widget classes so that all native methods can be mocked automatically on classload. For now, gwtmockito-ng can only support mocking for GWT.create method and inject fields and constructor parameters in presenters automatically. This will force us to follow MVP pattern and better separate pure UI logic with business logic, all business logic should be put into presenters.

I hope this could be useful to someone else too.

相关问题