Unit Test Path configuration problem

I'm trying to do some unit tests for a GWT project and when I try to run them the test class can never be found.  It is the same if I write the test or Intellij generates the test.

intellij-screen.png
The build is done with an ANT script and the working directory points to the WEB-INF/classes directory.  I've tried pointing to the top level directory but it does not work.  I've checked the project to make sure the output directory is the WEB-INF/classes.  This is a path problem.  Is there another place I can check for the path to the classes?

thanks

2 comments
Comment actions Permalink

The working directory is not added to the classpath. It is simply the value used to set the

'user.dir'
system property. (And therefore becomes a factor when creating relative FIle or Path objects.) The classpath of the module defined in the "Use classpath of module" is what is used. So you need to make sure your that module's definition ('CSE40' in your case) has the class you are trying to run in its classpath. Specifically, since it is a test, make sure that in the Project Structure dialog, with the 'CSE40' module selected, that on the "scope" tab the "Test output path" is correctly set to where your ant build puts its test classes. Does your build put the test classes in the WEB-INF/classes directory?
0
Comment actions Permalink

The test class was in the WEB-INF/classes.  The ant build was working but the path was not getting picked up by the test runner.

The only way I could get past this was moving the working directory to the project root (C:\CSE40) and change the configuration to make rather than the ant build.  I have no idea why there should be a difference but that solves it.

thanks for the help

0

Please sign in to leave a comment.