gwt-test-utils does not find my entry point class

672 views Asked by At

I am trying to get gwt-test-utils to work. I set up the project in the following way:

src/main/java : all the java source code
src/test/java : the test source code
src/test/resources : resource files for the tests

I am building my project with gradle and eclipse. Gradle uses these directories correctly by default and I added all three of them as source directories to Eclipse.

I have successfully built and run the project and was able to execute some plain old JUnit tests as well as a GWTTestCase, so I think I set up the project and its dependencies correctly.

Now I wanted to use gwt-test-utils for some more advanced integration tests. To do so I did the following:

  1. Add the gwt-test-utils and gwt-test-utils-csv to my dependencies

    gwtTestUtilsVersion = '0.45'
    testCompile group:'com.googlecode.gwt-test-utils', name:'gwt-test-utils', version:gwtTestUtilsVersion
    testCompile group:'com.googlecode.gwt-test-utils', name:'gwt-test-utils-csv', version:gwtTestUtilsVersion
    
  2. Add a gwt-test-utils.properties file to the directory src/test/resources/META-INF with the following content:

    path/to/my/module = gwt-module
    
  3. Added a class that extends GwtCsvTest to a package in the src/test/java directory. It is modeled after the second example in HowToWriteCsvScenario from the gwt-test-utils project wiki, replacing occurrence of their example classes with mine. It looks like this

    @CsvDirectory(value = "gwtTests")
    public class LoginLogoutTest extends GwtCsvTest
    {
        @Mock
        private MainServiceAsync mainService;
    
        private AppController appController = new AppController();
    
        @CsvMethod
        public void initApp()
        {
            appController.onModuleLoad();
        }
    
        @Before
        public void setup()
        {
            GwtFinder.registerNodeFinder("myApp", new NodeObjectFinder()
            {
                @Override
                public Object find(Node node)
                {
                    return csvRunner.getNodeValue(appController, node);
                }
            });
    
            GwtFinder.registerNodeFinder("loginView", new NodeObjectFinder()
            {
                @Override
                public Object find(Node node)
                {
                    return csvRunner.getNodeValue(appController.getRootPresenter().getCurrentlyActiveSubPresenters().iterator().next().getView(), node);
                }
            });
    
            addGwtCreateHandler(createRemoteServiceCreateHandler());
        }
    }
    
  4. added a csv-file for configuring the test to src/test/resources/gwtTests with the following content

    start initApp assertExist;/loginView/emailTextBox

I tried executing it via the Eclipse's Run As > JUnit Test and indirectly via gradle build (which executes all the test cases, not just this one). Both lead to the same error:

ERROR GwtTreeLogger Unable to find type 'myPackage.client.AppController'
ERROR GwtTreeLogger Hint: Check that the type name 'myPackage.client.AppController' is really what you meant
ERROR GwtTreeLogger Hint: Check that your classpath includes all required source roots

The AppController class is the entry-point configured in the module I configured in gwt-test-utils.properties, which makes me think that configuration works correctly and the rest of the setup (dependencies and all) work as well.

In an earlier version I used the same file as a subclass of GWTTestCase and created an AppController instance in the same way. That worked, so I'm pretty sure the class path is setup correctly to include it as well. I also tried changing it back to the previous version just now and it still works.

I have no clue why the class is not found. Is there anything gwt-test-utils does differently which means I need to specifically set the class path for it? Otherwise it should just work, since both gradle and eclipse know about all the relevant source folders and dependencies.

0

There are 0 answers