【问题标题】:How to use selenium to test collaboration of multiple applications如何使用 selenium 测试多个应用程序的协作
【发布时间】:2013-03-25 13:34:09
【问题描述】:

我想使用 selenium 来测试两个或多个应用程序(主、监控、管理)如何协同工作。然而,我能找到的只是如何测试单个应用程序。

示例场景可能如下所示:

App 1 - user x tries to log in, but has no account and the login fails
App 2 - a user for App 1 is created
App 1 - user is now able to log in

App 1 - user x performs a task
App 2 - displays the performed task
App 1 - user x finishes a task
App 2 - displays the finished task

应用程序可能部署在不同的服务器上。通信是通过一个公共数据库执行的。这些应用程序不一定使用相同的技术堆栈来实现。

【问题讨论】:

    标签: selenium selenium-webdriver selenium-ide gui-testing ui-testing


    【解决方案1】:

    Selenium 旨在复制真实的用户行为。 因此,如果会话确实在真正用户离开 APP 1 时终止,那么在通过 selenium webdriver 运行这些步骤时会看到完全相同的行为。

    如果你还想做i,可以这样-

    @driver1 = Selenium::WebDriver.for(:remote, :url => @sel_grid_url, :desired_capabilities => @browser) #create a browser session controlled by driver1
    @driver2 = Selenium::WebDriver.for(:remote, :url => @sel_grid_url, :desired_capabilities => @browser) #create another browser session controlled by driver2
    @driver1.get "http://#{app1}/"
    ## user x tries to log in, but has no account and the login fails
    @driver2.get "http://#{app2}"
    ## a user for App 1 is created
    .
    .
    .
    

    上面的代码是用Ruby编写的,中间是用Selenium Grid 2实现的。

    【讨论】:

      【解决方案2】:

      Selenium IDE 不允许您在同一测试期间更改网站。但是您可以使用 Selenium Webdriver 轻松做到这一点。例如

      driver.get("yourFirstApp.com");
      //Test your stuff
      driver.get("yourSecondApp.com");
      //Test your stuff
      etc
      

      【讨论】:

      • 谢谢,Stephane,我担心答案会是这样...不会让新页面终止第一次会话吗?
      • 不,会话还是一样
      【解决方案3】:

      如果您像下面的代码一样留在同一个测试用例中 对话 ID、会话等不会有任何问题。

      @Test
      public void blablalb() {  
      driver.get(a1);  
      //code.... 
      driver.get(a2);  
      //code...
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-08-03
        • 2015-12-10
        • 1970-01-01
        • 2021-06-16
        • 2016-05-18
        • 2014-06-14
        • 1970-01-01
        • 2011-08-18
        相关资源
        最近更新 更多