Behat. Visual regression testing along the way

Wondering if you thought about an idea of takings screenshots along the way of executing behat tests and then compare them.

So you could combine functional testing and visual regression testing at the same time.

Would this be interesting for you?

Yes, I would think so. Anything to help improve test coverage while minimizing the amount of work, runtime, maintenance, etc.

The screenshots could serve as artifacts to refer to in case of bugs found as well.

But for the visual validation, how useful it might be also depends on how the screenshots are taken. Like what screens/pages, and whether taking subset of screen or whole page (e.g. particular elements).

Hi David, I was thinking about two ways of takings screenshots: either whole page or certain elements by CSS selectors. For example:
I take screenshot of element ".nav"

Do you think it covers most of the cases?

Percy has integration with Selenium Java and Python Bindings, maybe you may be able to hack a way to use it from PHP.

Yes, I think the two ways you are planning should cover most cases.

Good point. Let me check those too. Thank you!

Pure visual testing I like with Sikuli. Since I’m no coder I can’t say if this helps for PHP but there are some artifacts, just now found via google:

I had to google to find out what Behat was, sicne it’s PHP based, it really becomes a question you want to ask on StackOverflow or similar, and then maybe share your implementation later. I’ve rarely used a off-the-shelf framework, and so my take is, I just add the feature to my framework when I hit these. So sounds like something that needs upstreaming into the tool, or change to a tool you can control.

thank you @conrad.braam. For sure. I am building a visual regression testing SaaS tool. So this will be one of the features. Good point regarding StackOverflow.