How to load a value from . properties file in Cucumber-jvm step class

Manwlis.e picture Manwlis.e · Apr 29, 2016 · Viewed 10k times · Source

I have written a cucumber integration tests and it is running ok.

And then i wanted some class variables from the step.java to get their values from .properties values

public class cucumberStepClass { 
    @Value("${value.from.propertiesfile}")
    private String variable
//rest of integration test
}

Does anyone know how can i inject those values so my test can use them?

Answer

Mykola Gurov picture Mykola Gurov · May 16, 2016

Have you enabled integration with spring dependency injection? You need to add the cucumber-spring dependency for that. See https://docs.cucumber.io/cucumber/state/#spring