Skip to content

Instantly share code, notes, and snippets.

@gwpantazes
Created September 12, 2019 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwpantazes/5aca70459a7a089ad7ea187b5ec70e6a to your computer and use it in GitHub Desktop.
Save gwpantazes/5aca70459a7a089ad7ea187b5ec70e6a to your computer and use it in GitHub Desktop.
Cucumber Scenario Outline and custom configured ParameterType aren't compatible for step highlighting/usage detection
package com.example.test;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class MyStepdefs {
@Given("that we're using a scenario outline")
public void thatWeReUsingAScenarioOutline() {
}
@When("we use the example placeholder for a custom parameter type")
public void weUseTheExamplePlaceholderForACustomParameterType() {
}
@And("this is the sample step {customtype}")
public void thisIsTheSampleStepSample() {
}
@Then("IntelliJ \\/ CucumberJVM should be able to recognize that it's valid")
public void intellijCucumberJVMShouldBeAbleToRecognizeThatItSValid() {
}
}
Feature: Sample Feature
Scenario Outline: Scenario Outlines should be compatible with custom ParameterType
Given that we're using a scenario outline
When we use the example placeholder for a custom parameter type
And this is the sample step A
And this is the sample step <sample>
And this is the sample step "<sample>"
Then IntelliJ / CucumberJVM should be able to recognize that it's valid
Examples:
| sample |
| A |
package com.example.test;
import com.wolfram.rtester.util.Language;
import cucumber.api.TypeRegistry;
import cucumber.api.TypeRegistryConfigurer;
import io.cucumber.cucumberexpressions.ParameterType;
import java.util.Locale;
public class TypeRegistryConfiguration implements TypeRegistryConfigurer {
@Override
public Locale locale() {
return Locale.ENGLISH;
}
@Override
public void configureTypeRegistry(final TypeRegistry typeRegistry) {
typeRegistry.defineParameterType(new ParameterType<>(
"customtype",
"A|B|C",
String.class,
(String s) -> s
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment