简体   繁体   中英

How to ignore Cucumber paramer while having function with 2 parameters or pass string from object method

I have 2 parameters in function, but I would like to ignore the second one which is an object (or maybe it's possible to use one of the methods of this object and get string from it?).

feature file:

Scenario: Test scenario
  Given Example given step "test"

StepDef class:

@Given("Example given step {string}")
public void getData(String service, Object result) {
    service= new GetService(service);
    resultObject = result;
}

I know there is some custom parameter types, but im not sure if it's what I'm looking for.

Not sure if this is what you are asking.
But what about something like this?

@Given("Example given step $service")
public void getData(String service) {
    SomeClass.someMethod(service);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM