简体   繁体   中英

Can features be steps in cucumber?

Let's say I've got a feature called create_account , which calls a number of steps to create the account.

Now I want to make a more elaborate feature test where having an account is a really just a step in a bigger scenario. Do I need to recode my original feature as steps or can I call the original feature somehow in my new scenario?

You cannot call a feature or scenario from a step. But probably, what you want can be accomplished using Background (steps that will be executed before every scenario in a feature, see https://github.com/cucumber/cucumber/wiki/Background ):

Feature: Different ways to create account

  Background:
    # Some steps to create account

  Scenario: Create account
    # Nothing

  Scenario: Create account and do something
    # Something else

Or else, you can pack all the step of the initial scenario into a complex step and use it.

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