GWText comes with some great components that spices up your otherwise plain GWT components.
Place the 'gwtext.jar' file and include in your project classpath ie. compiler and shell script
@java -Xmx256M -cp "%~dp0\src;%~dp0\bin;C:/gwt-windows-1.5.2/gwt-user.jar;C:/gwt-windows-1.5.2/gwt-dev-windows.jar;C:/gwt-windows-1.5.2/gwtext.jar" com.google.gwt.dev.GWTCompiler -out "%~dp0\www" %* com.rsheyeah.gwt.UITest
Make sure you have these lines in UITest.gwt.xml file
<inherits name='com.gwtext.GwtExt' />
<script src="js/ext/adapter/ext/ext-base.js" />
<script src="js/ext/ext-all.js" />
<stylesheet src="js/ext/resources/css/ext-all.css" />
Lastly, just have the appropriate resource files in their respective js folder
Otherwise, the compiler screams "No source code is available for type com.gwtext.client.widgets.form.*****; did you forget to inherit a required module?"
Friday, March 13, 2009
Creating JUnit test cases for your GWT project
The importance of JUnit testing and benchmarking cannot be undermined for java projects, let alone GWT projects.
Out-of-box JUnit test support is shipped with GWT for client and server side synchronous and asynchronous testing.Each GWT JUnit test extends GWTTestCase and implements getModuleName() method which defines the interest of GWT module.
Hence, if you like to create a project "MyUITest" in eclipse:
Go to your GWT_HOME (the place where your gwt related jars reside) directory and in the command prompt, promptly type in
projectCreator -eclipse MyUITest
and
applicationCreator -eclipse MyUITest -out MyUITest com.rsheyeah.gwt.client.UITest
and the result is as follows:
Created directory MyUITest\src
Created directory MyUITest\src\com\rsheyeah\gwt
Created directory MyUITest\src\com\rsheyeah\gwt\client
Created directory MyUITest\src\com\rsheyeah\gwt\public
Created file MyUITest\src\com\rsheyeah\gwt\UITest.gwt.xml
Created file MyUITest\src\com\rsheyeah\gwt\public\UITest.html
Created file MyUITest\src\com\rsheyeah\gwt\public\UITest.css
Created file MyUITest\src\com\rsheyeah\gwt\client\UITest.java
Created file MyUITest\UITest.launch
Created file MyUITest\UITest-shell.cmd
Created file MyUITest\UITest-compile.cmd
Now heres the line which generates the junit files:
junitCreator -junit "F:\eclipse-jee-ganymede-SR2-win32\plugins\org.junit_3.8.2.v20080602-1318\junit.jar" -module com.rsheyeah.gwt.UITest -eclipse MyUITest com.rsheyeah.gwt.client.UITester
and the result is as follows:
Created directory C:\gwt-windows-1.5.2\test
Created directory C:\gwt-windows-1.5.2\test\com\rsheyeah\gwt\client
Created file C:\gwt-windows-1.5.2\test\com\rsheyeah\gwt\client\UITester.java
Created file C:\gwt-windows-1.5.2\UITester-hosted.launch
Created file C:\gwt-windows-1.5.2\UITester-web.launch
Created file C:\gwt-windows-1.5.2\UITester-hosted.cmd
Created file C:\gwt-windows-1.5.2\UITester-web.cmd
Hence, it is recommended to use GWT JUnit for non-UI based tests, such as logic and functionality tests which may or may not require client and server asynchronous communication.
Out-of-box JUnit test support is shipped with GWT for client and server side synchronous and asynchronous testing.Each GWT JUnit test extends GWTTestCase and implements getModuleName() method which defines the interest of GWT module.
Hence, if you like to create a project "MyUITest" in eclipse:
Go to your GWT_HOME (the place where your gwt related jars reside) directory and in the command prompt, promptly type in
projectCreator -eclipse MyUITest
and
applicationCreator -eclipse MyUITest -out MyUITest com.rsheyeah.gwt.client.UITest
and the result is as follows:
Created directory MyUITest\src
Created directory MyUITest\src\com\rsheyeah\gwt
Created directory MyUITest\src\com\rsheyeah\gwt\client
Created directory MyUITest\src\com\rsheyeah\gwt\public
Created file MyUITest\src\com\rsheyeah\gwt\UITest.gwt.xml
Created file MyUITest\src\com\rsheyeah\gwt\public\UITest.html
Created file MyUITest\src\com\rsheyeah\gwt\public\UITest.css
Created file MyUITest\src\com\rsheyeah\gwt\client\UITest.java
Created file MyUITest\UITest.launch
Created file MyUITest\UITest-shell.cmd
Created file MyUITest\UITest-compile.cmd
Now heres the line which generates the junit files:
junitCreator -junit "F:\eclipse-jee-ganymede-SR2-win32\plugins\org.junit_3.8.2.v20080602-1318\junit.jar" -module com.rsheyeah.gwt.UITest -eclipse MyUITest com.rsheyeah.gwt.client.UITester
and the result is as follows:
Created directory C:\gwt-windows-1.5.2\test
Created directory C:\gwt-windows-1.5.2\test\com\rsheyeah\gwt\client
Created file C:\gwt-windows-1.5.2\test\com\rsheyeah\gwt\client\UITester.java
Created file C:\gwt-windows-1.5.2\UITester-hosted.launch
Created file C:\gwt-windows-1.5.2\UITester-web.launch
Created file C:\gwt-windows-1.5.2\UITester-hosted.cmd
Created file C:\gwt-windows-1.5.2\UITester-web.cmd
Hence, it is recommended to use GWT JUnit for non-UI based tests, such as logic and functionality tests which may or may not require client and server asynchronous communication.
Subscribe to:
Posts (Atom)