Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    GWT TestCases

    Hi I am new to GWT and my manager assign some task to write TestCases for GWT application.In my case I am thinking to write TestCase for my entry class only.But he wants some thing that view should be tested i.e button is hides or not after certan event.Is there any way to test These senarios with our GWTTEstCases.

    I am attching my code your reference.

    My Class has this method

    Code:
      public void onModuleLoad() {
    		
    		Log.showLogWindow(false);
    		Log.setUncaughtExceptionHandler();
    		/*
    		 * Use a deferred command so that the UncaughtExceptionHandler * catches
    		 * any exceptions in loadApp()
    		 */
    		DeferredCommand.addCommand(new Command() {
    			public void execute() {
    				loadApp();					
    			}			
    		});
    		
    }
    
    public void loadApp(){
    		Log.debug("This is a 'DEBUG' test message");
    		Log.info("This is a 'INFO' test message");
    		Log.warn("This is a 'WARN' test message");
    		Log.error("This is a 'ERROR' test message");
    		Log.fatal("This is a 'FATAL' test message");
    		
    		CallPlanAsyncService service = GWT.create(CallPlanAsyncService.class);
    		HandlerManager eventBus = new HandlerManager(null);
    		controller = new CallPlanEditorController(service,eventBus);
    		clearCookies();
    		registerMethods();
    		controller.go(RootPanel.get("tfPort"));
    	}
    aND HAD CERTAIN event

    #2
    I developed some parts of an application in GWT (version 2.0 as it is) and I wanted to incorporate that part of the work into Smartclient Pro Edition but it gives errors on just attempting to copy and place the code into SmartClient. Any ideas or directions on the best ways to go? Any documentation anywhere?

    Comment


      #3
      @raj.mishra: GWT and SmartGWT are two different things.

      @smuhanguzi: You would have to provide more information. Just copy and paste doesn't really mean anything. Good place to start is the Showcase examples.

      Comment


        #4
        Hi I tried to run my GWTTestCase in my existing project but it's giving this error...

        Attaching the code and error logs...

        Code:
        package com.qwest.eqsms.client;
        
        import com.google.gwt.junit.client.GWTTestCase;
        
        
        public class MyApplicationTest extends GWTTestCase {
        
           
        	@Override
        	public String getModuleName() {
        		System.out.println("Inside getModulename");
        		// TODO Auto-generated method stub
        		return "com.company.eqsms.MyApplication";
        	}
        	
        
        	public void testLoadApp() {
        		System.out.println("Testload app started");
        	}
        
        }
        Error logs are as follows
        Code:
        com.google.gwt.junit.client.TimeoutException: The browser did not contact the server within 60000ms.
         - 1 client(s) haven't responded back to JUnitShell since the start of the test.
         Actual time elapsed: 60.156 seconds.
        
        	at com.google.gwt.junit.JUnitShell.notDone(JUnitShell.java:895)
        	at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1175)
        	at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1197)
        	at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1197)
        	at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1103)
        	at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:522)
        	at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:406)
        	at junit.framework.TestCase.runBare(TestCase.java:130)
        	at junit.framework.TestResult$1.protect(TestResult.java:106)
        	at junit.framework.TestResult.runProtected(TestResult.java:124)
        	at junit.framework.TestResult.run(TestResult.java:109)
        	at junit.framework.TestCase.run(TestCase.java:120)
        	at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:282)
        	at junit.framework.TestSuite.runTest(TestSuite.java:230)
        	at junit.framework.TestSuite.run(TestSuite.java:225)
        	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
        	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
        Code:
        Inside getModulename
        Inside getModulename
        Inside getModulename
        Starting HTTP on port 0
           [WARN] Error deploying web application directory ROOT
        javax.xml.parsers.FactoryConfigurationError: Provider weblogic.xml.jaxp.RegistryDocumentBuilderFactory not found
        	at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
        	at org.apache.commons.modeler.util.DomUtil.readXml(DomUtil.java:284)
        	at org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.execute(MbeansDescriptorsDOMSource.java:130)
        	at org.apache.commons.modeler.modules.MbeansDescriptorsDOMSource.loadDescriptors(MbeansDescriptorsDOMSource.java:120)
        	at org.apache.commons.modeler.Registry.load(Registry.java:819)
        	at org.apache.commons.modeler.Registry.loadDescriptors(Registry.java:931)
        	at org.apache.commons.modeler.Registry.loadDescriptors(Registry.java:909)
        	at org.apache.commons.modeler.Registry.findDescriptor(Registry.java:992)
        	at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:696)
        	at org.apache.commons.modeler.Registry.findManagedBean(Registry.java:1047)
        	at org.apache.commons.modeler.Registry.registerComponent(Registry.java:859)
        	at org.apache.catalina.loader.WebappLoader.init(WebappLoader.java:612)
        	at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:644)
        	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4231)
        	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
        	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
        	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
        	at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
        	at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
        	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
        	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
        	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
        	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
        	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
        	at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
        	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
        	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
        	at org.apache.catalina.startup.Embedded.start(Embedded.java:846)
        	at com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.<init>(EmbeddedTomcatServer.java:262)
        	at com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.start(EmbeddedTomcatServer.java:74)
        	at com.google.gwt.dev.GWTShell.doStartUpServer(GWTShell.java:201)
        	at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:938)
        	at com.google.gwt.junit.JUnitShell.getUnitTestShell(JUnitShell.java:630)
        	at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:522)
        	at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:406)
        	at junit.framework.TestCase.runBare(TestCase.java:130)
        	at junit.framework.TestResult$1.protect(TestResult.java:106)
        	at junit.framework.TestResult.runProtected(TestResult.java:124)
        	at junit.framework.TestResult.run(TestResult.java:109)
        	at junit.framework.TestCase.run(TestCase.java:120)
        	at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:282)
        	at junit.framework.TestSuite.runTest(TestSuite.java:230)
        	at junit.framework.TestSuite.run(TestSuite.java:225)
        	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
        	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
           HTTP listening on port 4280
        Inside getModulename
        Inside getModulename
        Validating newly compiled units
           [WARN] Warnings in 'jar:file:/C:/RAJKAMAL/eclipseWorkspace/workspace/SSP_Oct_Stage/war/WEB-INF/lib/gwt-incubator-2.0.1.jar!/com/google/gwt/widgetideas/client/impl/GlassPanelImpl.java'
              [WARN] Line 30: Referencing deprecated class 'com.google.gwt.user.client.impl.DocumentRootImpl'
              [WARN] Line 38: Referencing deprecated class 'com.google.gwt.user.client.impl.DocumentRootImpl'
           [WARN] Warnings in 'jar:file:/C:/RAJKAMAL/eclipseWorkspace/workspace/SSP_Oct_Stage/war/WEB-INF/lib/gwt-incubator-2.0.1.jar!/com/google/gwt/widgetideas/table/client/GridBulkRenderer.java'
              [WARN] Line 102: Referencing deprecated class 'com.google.gwt.widgetideas.table.client.overrides.HTMLTable'
              [WARN] Line 103: Referencing deprecated class 'com.google.gwt.widgetideas.table.client.overrides.Grid'
              [WARN] Line 104: Referencing deprecated class 'com.google.gwt.widgetideas.table.client.overrides.Grid'
              [WARN] Line 104: Referencing deprecated class 'com.google.gwt.widgetideas.table.client.overrides.HTMLTable'
           [WARN] Warnings in 'jar:file:/C:/RAJKAMAL/eclipseWorkspace/workspace/SSP_Oct_Stage/war/WEB-INF/lib/gwt-incubator-2.0.1.jar!/com/google/gwt/widgetideas/table/client/FixedWidthGridBulkRenderer.java'
              [WARN] Line 122: Referencing deprecated class 'com.google.gwt.widgetideas.table.client.overrides.HTMLTable'
           [WARN] Warnings in 'jar:file:/C:/RAJKAMAL/eclipseWorkspace/workspace/SSP_Oct_Stage/war/WEB-INF/lib/gwt-incubator-2.0.1.jar!/com/google/gwt/widgetideas/table/client/TableBulkRenderer.java'
              [WARN] Line 404: Referencing deprecated class 'com.google.gwt.widgetideas.table.client.overrides.HTMLTable'
         http://10.140.40.132:4280/com.company.eqsms.MyApplication.JUnit/junit.html?gwt.codesvr=10.140.40.132:4277 on browser FF3
        [WARN] com.company.eqsms.MyApplication.JUnit:com.company.eqsms.MyApplication.testLoadApp is being retried, retry attempt = 1
        Inside getModulename
        Inside getModulename
        Inside getModulename
        Starting http://10.140.40.132:4280/com.company.eqsms.MyApplication.JUnit/junit.html?gwt.codesvr=10.140.40.132:4277 on browser FF3
        [WARN] com.company.eqsms.MyApplication.JUnit:com.company.eqsms.MyApplication.testLoadApp is being retried, retry attempt = 2
        Inside getModulename
        Inside getModulename
        Inside getModulename
        Starting http://10.140.40.132:4280/com.company.eqsms.MyApplication.JUnit/junit.html?gwt.codesvr=10.140.40.132:4277 on browser FF3

        Comment

        Working...
        X