Online Training: Web test automation with CodeceptJS. Sign up now!

Can I write any other extra function beside scenario, feature and hooks?

Hi
I want to write an extra function in test file that I use in multiple Scenarios. Is it possible?

Thank you,
Nadim

@nadimsaker Hi, I would recommend having a look at pageObjects if you want to reuse a function in multiple scenarios - Page Objects
If this is not what you are looking for, have a look at:

Also, to answer precisely your question, yes that is possible, though it’s not a best practice. Best practice dictates that if you want to reuse your code in multiple scenario use PageObject pattern or StepObjects (which are nothing more than PageObjects without locators)

@unreal2frag Thank you.