Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groovy Eclipse can't launch junit tests

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

enter image description here

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

like image 863
Philippe Blayo Avatar asked Oct 08 '12 12:10

Philippe Blayo


People also ask

How do I run a groovy JUnit test in Eclipse?

Please upgrade to the Alpha version of the groovy-eclipse plugin V2. You can run all unit tests in a project by right-clicking and selecting Run as->JUnit. In the new version of the plugin, Junit tests are treated identically whether they are written in Java or Groovy.

Why is JUnit not working in Eclipse?

The error occurs because the JUnit library has not been configured for the project, but can be resolved using the following steps. 1. Right click on the Java project and select Build Path > Configure Build Path. 2.


3 Answers

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.

like image 184
Aaron L. Johnson Avatar answered Sep 21 '22 16:09

Aaron L. Johnson


This happens normally when the folder in which test case is present is not a source folder, please check this post as well. Hope that helps!

like image 42
Anshu Avatar answered Sep 17 '22 16:09

Anshu


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.

enter image description here

like image 44
Aniket Thakur Avatar answered Sep 17 '22 16:09

Aniket Thakur