Reputation: 11020
In Eclipse with groovy plugin, I try to launch a test @Test public void testToLaunch() {...}
but I have the error:
The input type of the launch configuration does not exist
What input type
is in the context of launch configuration? (can't find such an entry in launch configuration window)
Note: I try sts 2.8.1 and e3.7
Upvotes: 18
Views: 27107
Reputation: 309
If you are using VS code Java Test Runner and "getting The input type of the Launch Configuration does not exist" ... Make sure your file and class name match.
Upvotes: 0
Reputation: 10931
Found another way to cause this message. The cause turned out to be an empty copy of MyTest.java
under src/main/java
, as well as the real one under src/test/java
.
Think the empty file was a hangover from some refactoring and was oddly causing no compile errors either. Deleting it enabled the test to run again.
Upvotes: 0
Reputation: 56
I had a spelling mistake which lead to that error message. My test class file name was named JUnit5Test.java
(with upper U
) and the class itself was named Junit5Test
(with lower u
).
I was using Spring Tool Suite 4 (4.8.0.RELEASE).
Upvotes: 2
Reputation: 1253
Whenever you create a Junit test in eclipse, make sure your Junit test file is inside src/test/java
folder.
Upvotes: 1
Reputation: 146
2019 Update: This drove me crazy for days even with latest Eclipse and fresh installs (Mac, Grails 4, Gradle 5.1.1, Java 8). Some above examples led me to the solution.
My problem was more that the code I was testing included a mix of groovy and java src/main code. It gave me NoClassDefFound on the .groovy classes when I ran my Spec as JUnit.
Solution: I had to modify my Run/Debug Configuration to include build/classes/groovy/main. Then it worked. It's a little bit of a pain to remember to that for every new Configuration, but, it keeps me going. I hope it helps you.
Upvotes: 1
Reputation: 1
This is what resolved for me (Eclipse Oxygen)
. I had already done what Robert suggested in the earlier post. I was still getting the error. When I went to edit the configuration for junit launch, I saw that the Test Class field just had the class name. I had to hit the Search button to the right. The Test Class field now had the complete name for the class
com.mycompany.mypackage.MyClass
With this I am able to run the JUnit
. But I have to keep fixing this for every run.
Upvotes: 0
Reputation:
I had a similar problem. Like others have already pointed out, it was about source folders. I had to change my source folder setup. There was an empty src-folder that disappeared after I right-clicked on it and selected 'remove from build path' from Build path menu. After that I right-clicked both java/src and java/test folders and chose Build path > Use as a source folder. And suddenly my tests were JUnited!
In similar situations I'd advice to remove all source folders from build path and add them again when you're sure you've got the right ones. Your source folders should be those with Java package structure under them. In case of proj/java/test/com/stackoverflow/main it's the 'test' folder.
Upvotes: 0
Reputation: 68935
In Eclipse you can do
Right click -> properties -> Java build path
Notice test folder is not available in sources. Add it.
Add folder -> Select test -> OK
Now rerun you unit test cases.
Upvotes: 7
Reputation: 15872
I had the same error message when I head the test-class duplicated both in the main Java source folder and the testsrc folder. Removing the incorrectly placed one in the main Java source folder solved the problem for me.
Upvotes: 1
Reputation: 191
This can also happen if there is a problem with the groovy class. A few things to check:
1) Ensure that the class name exactly matches the filename (filename = MyTest.groovy
)
package com.mypackage;
import groovy.util.GroovyTestCase;
class MyTest extends GroovyTestCase {}
2) Ensure that the package defined in the file matches the package the file is actually in.
Upvotes: 15
Reputation: 675
This also happened to me. But these tests are written in Groovy. The problem I encountered has to do with how the IDE (Eclipse Kepler, Java EE) first opens a Groovy project after executing "mvn eclipse:eclipse".
The Build Paths do not reference the Groovy source files correctly.
To resolve, I:
Hope this saves time for someone.
Cheers!
Upvotes: 1
Reputation: 4436
This happened to me, and I just restarted Eclipse (GGTS) and everything was fine again.
Upvotes: 2