3

I have a class that I made for some unit tests. Everything was going swimmingly until I changed the name of the class to match the class that I was testing suffixed with TestCase. All of a sudden every time I tried to run the test case in Eclipse I get a "There is no input configuration for this type".

Someone then suggested that there is a 30 character length limit on the name of the class. I had a look at the class name and it was 32 characters long. I then deleted two characters off the end and tried again and everything worked. I put them back and it stopped working.

Is there an explanation for this?

EDIT:

In response to some of the comments. It is Galileo, using Windows XP, JUnit 4.4.

EDIT 2:

Sorry guys. I guess I was wrong. The pattern seems to be that JUnit/Eclipse does not like my class name being TestCase. As soon as I take the TestCase part away it works. It works with a massively long string, short strings and everything in between. The name can be anything like ABCTestCase it just CANNOT be for some reason TestCase.

Allan Bowe
  • 12,306
  • 19
  • 75
  • 124
uriDium
  • 13,110
  • 20
  • 78
  • 138
  • Hmmm. Does it run outside of Eclipse? Maybe it is an issue in the JUnit Eclipse plugin instead of in JUnit itself. – Simon Groenewolt Sep 21 '09 at 10:05
  • Just tried a class with a 153 character name (FQN of 178 characters) with no issue in eclipse. – Michael Lloyd Lee mlk Sep 21 '09 at 10:09
  • What OS are you on? On Windows there is a maximum path length of 260, so if you have a deeply nested class structure, that could be a problem: http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maximum_path_length – ire_and_curses Sep 21 '09 at 10:38
  • Just completed my answer with the different known limits, plus a theory on where the process might be over those limits. – VonC Sep 21 '09 at 11:33

4 Answers4

1

By default I believe the JUnit runners are set to look for *Test files, so it will filter out TestCase. People often use *TestCase as a base class without any tests of its own. Not sure if that's what you're running into. If so, it's configurable in the runner.

ndp
  • 21,546
  • 5
  • 36
  • 52
1

Turns out that it was because I was extending TestCase which makes the JUnit runner think it is still version 3. Even if you tell it to use version 4.

uriDium
  • 13,110
  • 20
  • 78
  • 138
0

I am not sure this is linked at all to some kind of OS length limitation, but rather to:

  • some hard-coded parametrization based on the name of the class.
  • or to some problem with the source folder.
    Indeed, you message looks like:

alt text

From QuickTip: JUnit: The input type of the launch configuration does not exist

If you are getting the above error message in Eclipse IDE, while running your test case, just make sure that you have the test class as a part of the “eclipse source folder” definition.

Easiest way. Right click on the folder –> Build Path –>Use as source folder


There could be a length limit issue (you can see some projects undergoing a refactoring "to be under the file length limit" (org.eclipse.jdt.core.tests.performance).

But that is strange, considering the length limit on Windows are:

  • 32767 characters for the maximum command line length for the CreateProcess function. This limitation comes from the UNICODE_STRING structure. CreateProcess is the core function for creating processes, so if you are talking directly to Win32, then that's the only limit you have to worry about. But if you are reaching CreateProcess by some other means, then the path you travel through may have other limits.
  • 8192 character command line length limit imposed by CMD.EXE.
  • 2048 length due to the INTERNET_MAX_URL_LENGTH (around 2048) command line length limit imposed by the ShellExecute/Ex functions. (If you are running on Windows 95, then the limit is only MAX_PATH.)
  • 32767 characters for the maximum size of your environment (includes the all the variable names plus all the values)

Maybe the total length of the javac command does exceed one of those limits, and fail to compile one of those JUnit Java classes, meaning it can no longer be executed (and trigger the above error message)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Can't be. It works if the class name is under 30 characters and not when over 30 characters. The above error is what I am seeing yes. But I also did a Google and the link is the first one I came across. It is most definitely on the build bath. – uriDium Sep 21 '09 at 10:55
  • @uriDium: ok (I did not find that link right away, since you did not copy *exactly* the error message). May be some length limit related to the Build Path, then? – VonC Sep 21 '09 at 11:01
  • Sorry about the exact message :( I was trying to type it in from memory. It seems that way. There seems to be people that are coping with quite a long name. The build path might be quite lengthy at that point. I will keep investigating. – uriDium Sep 21 '09 at 11:13
0

Check your run Configuration under Run -> Run... Your Test has a Configuration there. Check the "Test class" field.

keuleJ
  • 3,418
  • 4
  • 30
  • 51