asd11_81 asd11_81 - 29 days ago 20
PHP Question

I need to share data between steps in different classes

I need to share data between steps in different classes using BEHAT.
Something like (Good practice to pass variables between cucumber-jvm steps) PicoContainer for cucumber. Is there such a framework? I know I can use static member but maybe is some framework for this.

Answer

You have multiple options:

  1. Create a specialized class with static methods to handle different data

  2. Use Behat functionality to communicate between contexts, see similar question accessing contexts from each other

  3. If you need to generate different data use Faker for php

Comments