我有一个 GWT 复合组件,有两个文本框,想为它编写测试用例。他们每个人都有更改处理程序,我想知道如何将更改事件触发到复合组件类中的确切组件。
已编辑: 我的测试代码如下所示,
@Test
public void testValueChangesToOutOfRange(){
DvCountUI count = new DvCountUI(15, "place holder", true);
count.specifyNormalRange(10, 30);
TextBox magnitude = GwtReflectionUtils.getPrivateFieldValue(count, "magnitude");
assertTrue(true);
}
当我使用 GWT Junit Test 运行它时,我得到 ERROR: in console
Validating units:
Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[ERROR] Errors in 'file:/D:/TRANSFER/asclepian/workspace/UIBuilder/src/com/rubirules/uibuilder/client/DvCountUITest.java'
[ERROR] Line 65: No source code is available for type com.googlecode.gwt.test.utils.GwtReflectionUtils; did you forget to inherit a required module?
[ERROR] Unable to find type 'com.rubirules.uibuilder.client.DvCountUITest'
[ERROR] Hint: Previous compiler errors may have made this type unavailable
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
并在六月
JUnitFatalLaunchException
我的 gwt.xml 文件如下所示:
<module rename-to='uibuilder'>
<inherits name='com.google.gwt.user.User' />
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<entry-point class='com.rubirules.uibuilder.client.UIBuilder' />
<source path='client' />
<source path='shared' />
</module>
这里有什么问题?我还在项目库中添加了 gwt-test-utils jar。