普通网友 2012-09-27 05:17
浏览 65
已采纳

Behat Mink webdriver会话在套件中的每个功能之后被销毁

I am trying to automate sugarcrm functionality with behat BDD and Mink with selenium webdriver for php. I have properly installed both of them and able to run behat and mink together. for example checking login on sugarcrm as one feature.

Now the problem is when i create two feature file say login.feature and setup.feature. Behat successfully automate login process in browser but as soon as it switches to setup.feature which require login session to be maintained from previous feature, it destroy session and comes back to login window. therefore, second feature test is always failing.

How i can maintain session for every feature in my feature suite?

Just to tell you guys that i have also tried them in a single feature file as different scenario but with no luck as the same thing is haapening

Please Help me if anyone knows about it.

  • 写回答

2条回答 默认 最新

  • drqvsx1228 2012-09-27 10:31
    关注

    Features and scenarios should be independent. It is THE expected behaviour that if you do something in one scenario, the state is not carried to the next one.

    I'm not sure what you're trying to achieve but you definitely doing something wrong.

    Edit:

    If you need to log user in before every scenario simply write a meta step which will perform all the necessary operations:

    Given I am logged in
    

    You could use step execution chaining or simply call Mink directly.

    If every scenario in your feature file requires logging in you can use background:

    Background:
        Given I am logged in
    
    Scenario: Listing users
        Given ...
    
    Scenario: Removing a user
        Given ...
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀