Skip to main content

Behat feature hooks

Feature hooks are triggered before or after each feature runs. Feature hooks should also be defined as public static methods.

/**
 * @BeforeFeature
*/
public static function setupFeature()
{
    echo "Before Feature Executed";
}

/**
* @AfterFeature
*/
public static function teardownfeature()
{
    echo "After Feature Executed";
}

@BeforeFeature: gets executed before every feature in the suite.
@AfterFeature: gets executed after every feature in the suite.

BeforeFeature will execute after BeforeSuite and AfterFeature will execute before AfterSuite.

Submitted by tgoswami on November 23, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.