我有一個GWT複合組件,有兩個文本框,想爲它編寫測試用例。他們每個人都有更改處理程序,我想知道如何將更改事件觸發到複合組件類中的確切組件。GWT compositC組件測試用例?
編輯: 我的測試代碼如下所示,
@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測試運行它我得到錯誤: 控制檯
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
,並在JUnit
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。
謝謝,SSR,我嘗試測試用例,如http://code.google.com/p/gwt-test-utils/wiki/Events, 現在我正在獲取com.google.gwt.junit.JUnitFatalLaunchException測試類中的編譯錯誤。 – Dipak
如果可用或在您的問題中提及,您應該最好使用gwt-test-utils進行重新授權。請參閱最新文檔https://github.com/gwt-test-utils/gwt-test-utils/wiki/Browser-simulation。它不是理想的情況。堅持基本的單元測試策略和「Follo GWT團隊」。此外,我寧願依賴Selenium + GWTTestCase策略,而不是其他任何第三方工具。 – SSR
你會不會檢查出最新的問題,我沒有得到解決。 – Dipak