duanqin7791 2014-10-22 15:13
浏览 60

Windows上的Behat - 截图

I've got several Behat tests that take screenshots using something similar to this:

$driver->getWebDriverSession()->screenshot();

Does anyone know of a Behat plugin or extension that can compare two screenshots? And it must work on Windows.

  • 写回答

2条回答 默认 最新

  • drza10046 2014-10-24 20:22
    关注

    I've been working with Behat for awhile now and it's certainly isn't as popular as it should be. There's not that many popular plugins from any team other than Behat's, and there's definitely no well-known / well-supported plugin for Behat to compare images. In fact that would be true for PHP as well, except for the GD and Imagic, which have a much broader scope.

    Besides, the logic isn't very clear what and how you'd compare. Screenshots are normally taken on failure. Comparing two screenshots of failed tests doesn't make much sense, only comparing screenshots of failed tests against screenshots of relevant tests that passed before. The questions is then where and how would you get those valid screenshots, and the whole chain of other questions coming from here.

    That sounds like a very specific challenge and I'm certain only a limited group of users would need something like that, probably with a lot of logic unique and specific to their case. On another hand, implementing basic image comparison in PHP isn't that difficult, given you have the basic skills working with graphics in PHP.

    One thing that comes to mind is Imagick::compareImages, see the official documentation. There also seem to be plenty of blog posts, like this one or this one, which show different ways of doing that.

    评论

报告相同问题?

悬赏问题

  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法