Forum Discussion

Camo's avatar
Occasional Contributor
4 years ago

Where to store common logic like login

I have a few features which test resources which needs to login. Every feature has its own steps class with concrete steps. But each of this features needs to make login, so I tried to make baseSteps which contains 


    public void login()
        new HomepagePage().login(conf.getString(""), conf.getString("login.password"));


But as I see Cucumber does not allow inheritance of classes with steps and hooks.

It throws me an error: Unable to start Cucumber You're not allowed to extend classes that define Step Definitions or hooks. class steps.admin.CreateEditArticleSteps extends class steps.BaseSteps


What is the best practice to achieve this logic? I dont want to have login method in every steps class. 

2 Replies

    • Camo's avatar
      Occasional Contributor

      No did not find it. But found a some mentions which say the login should be the part of each scenario. This is something opposite. Thanks.