admin管理员组

文章数量:1123508

  • my env: Java+Spring+Cucumber
  • what I want: I need move all steps definition to the shred library. It means, that In my test project I have only cucumber's features, properties and runner class:
@Cucumber
@IncludeEngines("cucumber")
@SelectClasspathResource("com/tests")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.runner.project.test")

public class RunnerTest {  
}
  • What I do: I create library with step's definition classes and configuration class and include it with maven in my test project. Configuration class in library located in 'com.runner.project.test' package.
  • what I get: I run testcase ('.feature') and it runs successfully. Than I run 'RunnerTest.class' and take trouble: 'io.cucumber.core.backend.CucumberBackendException: Please annotate a glue class with some context configuration.'
  • what I try: I relocate my configuration class from library to the my test project. Than I get trouble with step's definition: application doesn't see definition classes. But if I ctrl+LM on step in testcase '.feature', than I'm falling to the definition step.
  • question: How I can linked RunnerTest.class and configuration class located in library?

Configuration class:

@CucumberContextConfiguration
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
@EnableConfigurationProperties
@EnableAutoConfiguration
@ComponentScan
@Import(Config.class)
public class MyTestContext {

    @Configuration
    public static class Config {....}

本文标签: javaHow move CucumberContextConfiguration class to the libraryStack Overflow