doujiao1948 2014-09-16 23:47
浏览 23
已采纳

Behat:如何测试密码重置表单?

I've just started to build an API & Some web app features, using Behat to test scenarios in a BDD fashion.

All is going well, I'm testing the API with a Rest Context and Web App bits with Mink.

However, I've reached a bit of a stumbling block in the automated tests...

I've created an API endpoint for a "Forgot Password" feature, which does the usual random hash/token effort, then emails a link to /reset-password/token

However, in order to automate testing of this URL using Mink I'd need to know the hash of the test user (created earlier in the test suite). Because it's random and will change every time a user requests a password reset, I'm a little stumped as to how I can test this!

  • 写回答

1条回答 默认 最新

  • duancuisan2503 2014-09-17 10:06
    关注

    Simple: don't be shy to lookup the last (or based on any other criteria) row in your password reset tokens table to get the last generated hash.

    If you are new to subject it might sound a little strange that with Behat / Mink you need to do things like that, but thats a totally normal practice to have shortcuts or workarounds like that.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退