uriDium
uriDium

Reputation: 13440

Does JUnit have some weird 30 character length limit on the name of your class?

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.

Upvotes: 3

Views: 3217

Answers (4)

uriDium
uriDium

Reputation: 13440

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.

Upvotes: 1

ndp
ndp

Reputation: 22006

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.

Upvotes: 1

VonC
VonC

Reputation: 1328912

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)

Upvotes: 0

keuleJ
keuleJ

Reputation: 3496

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

Upvotes: 0

Related Questions