I recently upgraded my Cucumber/Java-based test tool by upgrading the Cucumber dependencies from 4.3.1 to 4.7.0. Now Eclipse reports that the Then tag is deprecated. For example, in my Step Definition class, Eclipse reports a warning that The type Then is deprecated next to this method:
@Then("Invoke the Functional API")
public void invoke_the_functional_api(DataTable dataTable) {
/* Body of step definition */
}
The body of this step definition does not reference any other step definitions. Normally, when I see a deprecated warning, I would investigate how to replace the deprecated usage with more up-to-date code, but I can't work out what that would be in this case. Does anyone know?
The tag itself is not deprecated. The import is. You'll need to update your import statements to the new import.
" Migration info for deprecated classes (as of cucumber-jvm v4.5.x):
import io.cucumber.junit.CucumberOptions
import io.cucumber.junit.Cucumber
You can replace java8 lambda imports with io.cucumber.java8.En
And java with io.cucumber.java.en.Given
If you run via IDEA change the main class in the run configuration: io.cucumber.core.cli.Main."
Link to issue in the Cucumber docs: https://github.com/cucumber/docs.cucumber.io/issues/142#issuecomment-508719509
The body of this step definition does not reference any other step definitions. Normally, when I see a deprecated warning, I would investigate how to replace the deprecated usage with more up-to-date code, but I can't work out what that would be in this case. Does anyone know?
In your IDE you can use ctrl + Click
or fn + Click
to step to the source code of an element. Your IDE will then usually also ask you if you want to download the sources. You should do this. The Javadoc in the source code will tell you what the recommended class to migrate to is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With