cucumber / cucumber-eclipse

Eclipse plugin for Cucumber
MIT License
192 stars 149 forks source link

Plugin unable to find Step Definitions written in Groovy #172

Open pranasblk opened 8 years ago

pranasblk commented 8 years ago

After opening existing project created in IntelliJ (Groovy based) with the current plug-in I can see large number of warnings about " No definition found for <fragment of regexp>" the step defs in our case defined in src/integrationTest/groovy.

Some ideas how we can guide plug-in to look into the specific directory?

build.gradle fragments:

sourceSets {
  main {
    java {
      srcDir 'src/main/binding'
    }
  }
  integrationTest {
    groovy {
      compileClasspath += main.output + test.output
      runtimeClasspath += main.output + test.output
    }
    java {
      compileClasspath += main.output + test.output
      runtimeClasspath += main.output + test.output
    }
  }
}

configurations {
  integrationTest
  integrationTestCompile.extendsFrom testCompile
  integrationTestRuntime.extendsFrom testRuntime
}

...

dependencies {

 // ...

  // Logging
  compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.12'
  runtime group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.3'
  runtime group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.3'
  runtime group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.3'

  // Groovy support
  compile group: 'org.codehaus.groovy', name: 'groovy', version: '2.4.4'

  // Integration testing framework Cucumber JVM
  integrationTestCompile(
    [group: 'info.cukes', name: 'cucumber-groovy', version: '1.2.4'],
    [group: 'info.cukes', name: 'cucumber-core', version: '1.2.4'],
    [group: 'info.cukes', name: 'cucumber-junit', version: '1.2.4']
  )

  // JUnit and mocking
  testCompile group: 'org.jmockit', name: 'jmockit', version: '1.18'
  testCompile group: 'junit', name: 'junit', version: '4.12'
}

// Required for Intellij to pick up our custom integration test configuration
idea {
  module {
    testSourceDirs += sourceSets.integrationTest.allSource.getSrcDirs()
    scopes.TEST.plus += [configurations.integrationTestCompile]
  }
}
...
eclipse {
  classpath {
    plusConfigurations += [configurations.integrationTestCompile]
...
  }
}
...
task integTest(type: Test) {
  testClassesDir = sourceSets.integrationTest.output.classesDir
  classpath = sourceSets.integrationTest.runtimeClasspath
  systemProperty 'cucumber.options', '--plugin json:build/test-results/cucumber.json'
}

task integTestJar(type: Jar, dependsOn: integTest) {
  classifier = 'integTest'
  from sourceSets.integrationTest.output
}
JacksonBailey commented 7 years ago

With the new version I am now able to press F3 to go to the step-definitions defined in Groovy files. (Also they don't show as missing.) @pranasblk is that true for you too?

dinun commented 6 years ago

I am having this problem as well, @JacksonBailey how did you manage to configure the plugin to find your steps? Are they groovy classes or scripts?

JacksonBailey commented 6 years ago

@dinun they were Groovy classes for me. Also, worth mentioning, I was using cucumber-java annotations, not the cucumber-groovy closures. (The "normal" Java one, not Java 8 version.) I haven't used this plugin in a long time but I specifically remember that it only worked with cucumber-java annotations on "normal" Groovy methods in classes..

laeubi commented 5 years ago

Realtes to #275