Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 活动和视图的GWT单元测试_Unit Testing_Gwt_Junit - Fatal编程技术网

Unit testing 活动和视图的GWT单元测试

Unit testing 活动和视图的GWT单元测试,unit-testing,gwt,junit,Unit Testing,Gwt,Junit,有没有人有关于如何编写JRE junit测试(扩展TestCase而不是GWTTestCase)的教程链接,该测试在GWT2.1中测试活动和视图 致意 Pich视图只能使用GWTTestCase进行单元测试,因为它们调用(显式或隐式)GWT.create() 要测试活动,请使用模拟视图以避免使用GWT.create()我已设法使用PowerMock测试视图,其中当然包含对调用GWT.create()的对象的引用 对于活动,可以很容易地使用Mockito来模拟视图。如果活动包含对诸如GWT Pla

有没有人有关于如何编写JRE junit测试(扩展TestCase而不是GWTTestCase)的教程链接,该测试在GWT2.1中测试活动和视图

致意


Pich

视图只能使用GWTTestCase进行单元测试,因为它们调用(显式或隐式)
GWT.create()


要测试活动,请使用模拟视图以避免使用
GWT.create()

我已设法使用PowerMock测试视图,其中当然包含对调用GWT.create()的对象的引用


对于活动,可以很容易地使用Mockito来模拟视图。

如果活动包含对诸如GWT PlaceController之类的对象的引用(该对象在引擎盖下调用GWT.create()),该怎么办?(不幸的是,PlaceController是一个类,因此无法轻松模拟…
PlaceController
有一个专门用于此的构造函数:
PlaceController(EventBus EventBus,PlaceController.Delegate Delegate)
在这种情况下,您将模拟
委托
,而不是
PlaceController
。同样值得注意的是,大多数模拟框架(即EasyMock)都支持模拟具体类(有限制)。我更喜欢只模拟接口,所以这就是为什么我有这个问题。