Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: What is Cucumber's alternative for JBehave's @Alias annotation? #44

Open
edricklacbayo opened this issue Dec 3, 2020 · 8 comments
Labels

Comments

@edricklacbayo
Copy link

Hi @wakaleo is there any alternatives for Jbehave's @alias annotation?

For example, I want to use both annotations on one method.

@given(^I want to get an (.)$)
@alias(^I want to get a (.
)$)

@mraphael2101bt
Copy link

Hi, I would also be interested to know if there is?

@wakaleo
Copy link
Member

wakaleo commented Jul 15, 2022

In cucumber you can just repeat the @given annotations

@mraphael2101bt
Copy link

Hi, John.
Please could you share a simple step definition example to show what you mean?

@wakaleo
Copy link
Member

wakaleo commented Jul 15, 2022

@Giveniven(^I want to get an (.)$)
@Given(^I want to get a (.)$)
public void myStepDef(String value) {...}

@mraphael2101bt
Copy link

I am working with TypeScript not Java.

@mraphael2101bt
Copy link

Tried the above syntax in Java and it gave me duplicate tags despite the matchers being different

@wakaleo
Copy link
Member

wakaleo commented Jul 15, 2022

Here is a real example:

    @When("^(.*) opens the product details for \"(.*)\"")
    @When("^(.*) has opened the product details for \"(.*)\"")
    public void viewProductDetails(String actorName, String productName) {
        Actor actor = OnStage.theActorCalled(actorName);
        actor.attemptsTo(ViewInventoryItem.called(productName));
    }

This is a Cucumber question rather than a Serenity one, though, and if you need to know about TypeScript, you sould probably ask the Cucumber Typescript community (Serenity BDD is a Java project).

@mraphael2101bt
Copy link

Thanks John. Okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants