普通网友 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 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog