楼主: AlexQin

Getting Started with Selenium Grid

[复制链接]
论坛徽章:
1056
紫蜘蛛
日期:2015-09-22 15:53:22紫蜘蛛
日期:2015-10-15 13:48:52紫蜘蛛
日期:2015-10-15 14:45:48紫蜘蛛
日期:2015-10-15 14:47:47紫蜘蛛
日期:2015-10-15 14:48:45九尾狐狸
日期:2015-09-22 15:53:22九尾狐狸
日期:2015-10-15 13:50:37九尾狐狸
日期:2015-10-15 14:45:48九尾狐狸
日期:2015-10-15 14:47:47九尾狐狸
日期:2015-10-15 14:48:45
11#
 楼主| 发表于 2010-12-24 08:25 | 只看该作者
Running tests against the Grid

Now that we have set up the Grid with different instances, we should have a look at how we can write tests against these Remote Controls on the Grid. We can pass in the value of the target that we can see in the grid and then run the tests. So instead of passing in *firefox you can use "firefox on linux" and then run the tests as usual.

Let's see this in action.

Time for action – writing tests against the grid

  • Create a new test file.
  • Populate it with a test script that accesses an item on the grid and then works against http://book.theautomatedtester.co.uk/. Your script should look similar to the following:
    1. import org.junit.*;
    2. import com.thoughtworks.selenium.*;

    3. public class TestExamples2 {

    4.    Selenium selenium;

    5.    @Before
    6.    public void setUp(){
    7.      selenium = new DefaultSelenium("192.168.157.153",4444,
    8.       "Google Chrome on Linux",
    9.       "http://book.theautomatedtester.co.uk");//
    10.      selenium.start();
    11. }

    12. @After
    13. public void tearDown(){
    14.     selenium.stop();
    15. }

    16. @Test
    17. public void ShouldRunTestsAgainstGoogleChromeOnLinux(){
    18.     selenium.open("/");
    19.     selenium.click("link=chapter2");
    20.   }
    21. }
    复制代码


What just happened?
We have just seen how we can write tests that can run against the Grid and then run them. When the tests are running the grid will show which Remote Control is currently in use and which grid items are currently free. We can see this in the following screenshot:

使用道具 举报

回复
论坛徽章:
1056
紫蜘蛛
日期:2015-09-22 15:53:22紫蜘蛛
日期:2015-10-15 13:48:52紫蜘蛛
日期:2015-10-15 14:45:48紫蜘蛛
日期:2015-10-15 14:47:47紫蜘蛛
日期:2015-10-15 14:48:45九尾狐狸
日期:2015-09-22 15:53:22九尾狐狸
日期:2015-10-15 13:50:37九尾狐狸
日期:2015-10-15 14:45:48九尾狐狸
日期:2015-10-15 14:47:47九尾狐狸
日期:2015-10-15 14:48:45
12#
 楼主| 发表于 2010-12-24 08:26 | 只看该作者
Summary

We learned a lot in this article about how to set up Selenium Grid and all the different arguments needed, as well as running our tests against the Grid.
Specifically, we covered:
  • Starting Selenium Grid Hub: In this section we had a look at how we can start up Selenium Grid Hub that is the central point for Selenium Grid.
  • Setting up Selenium Grid Remote Controls: We had a look at all the arguments that are needed to add a Remote Control to the Grid so that we can use it. This gives us a more manageable view of our grid so that we can work with it.

We also discussed how we can create tests that use the grid.

使用道具 举报

回复
论坛徽章:
1056
紫蜘蛛
日期:2015-09-22 15:53:22紫蜘蛛
日期:2015-10-15 13:48:52紫蜘蛛
日期:2015-10-15 14:45:48紫蜘蛛
日期:2015-10-15 14:47:47紫蜘蛛
日期:2015-10-15 14:48:45九尾狐狸
日期:2015-09-22 15:53:22九尾狐狸
日期:2015-10-15 13:50:37九尾狐狸
日期:2015-10-15 14:45:48九尾狐狸
日期:2015-10-15 14:47:47九尾狐狸
日期:2015-10-15 14:48:45
13#
 楼主| 发表于 2010-12-24 08:27 | 只看该作者
You can download this book from ITPUB, and here is the URL:
Packt - Selenium 1.0 Testing Tools: Beginners Guide Nov 2010

使用道具 举报

回复
论坛徽章:
1309
ITPUB季度 技术新星
日期:2011-06-16 10:10:12海蓝宝石
日期:2012-04-03 16:46:37利物浦
日期:2023-02-13 12:39:45Heart of PUB
日期:2012-04-03 16:46:37指数菠菜纪念章
日期:2012-06-08 13:16:41季节之章:春
日期:2012-04-03 16:46:37季节之章:夏
日期:2012-04-03 16:46:37体育版块博采纪念徽章
日期:2008-07-03 19:47:13季节之章:秋
日期:2012-04-03 16:46:37季节之章:冬
日期:2012-04-03 16:46:37
14#
发表于 2010-12-24 11:03 | 只看该作者
Selenium IDE  is a Firefox add-on that records clicks, typing, and other actions to make a test, which you can play back in the browser.

那是不是只能在FF上运行,其他浏览器呢?

使用道具 举报

回复
论坛徽章:
1056
紫蜘蛛
日期:2015-09-22 15:53:22紫蜘蛛
日期:2015-10-15 13:48:52紫蜘蛛
日期:2015-10-15 14:45:48紫蜘蛛
日期:2015-10-15 14:47:47紫蜘蛛
日期:2015-10-15 14:48:45九尾狐狸
日期:2015-09-22 15:53:22九尾狐狸
日期:2015-10-15 13:50:37九尾狐狸
日期:2015-10-15 14:45:48九尾狐狸
日期:2015-10-15 14:47:47九尾狐狸
日期:2015-10-15 14:48:45
15#
 楼主| 发表于 2010-12-24 14:58 | 只看该作者
原帖由 michelle1011 于 2010-12-24 11:03 发表
Selenium IDE  is a Firefox add-on that records clicks, typing, and other actions to make a test, which you can play back in the browser.

那是不是只能在FF上运行,其他浏览器呢?

这是指Selenium IDE,不是Selenium Grid

使用道具 举报

回复
论坛徽章:
1056
紫蜘蛛
日期:2015-09-22 15:53:22紫蜘蛛
日期:2015-10-15 13:48:52紫蜘蛛
日期:2015-10-15 14:45:48紫蜘蛛
日期:2015-10-15 14:47:47紫蜘蛛
日期:2015-10-15 14:48:45九尾狐狸
日期:2015-09-22 15:53:22九尾狐狸
日期:2015-10-15 13:50:37九尾狐狸
日期:2015-10-15 14:45:48九尾狐狸
日期:2015-10-15 14:47:47九尾狐狸
日期:2015-10-15 14:48:45
16#
 楼主| 发表于 2010-12-24 15:05 | 只看该作者
Selenium IDE
Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and allows you to record, edit, and debug tests. Selenium IDE includes the entire Selenium Core, allowing you to easily and quickly...

http://www.oschina.net/p/selenium+ide/news

使用道具 举报

回复
论坛徽章:
1056
紫蜘蛛
日期:2015-09-22 15:53:22紫蜘蛛
日期:2015-10-15 13:48:52紫蜘蛛
日期:2015-10-15 14:45:48紫蜘蛛
日期:2015-10-15 14:47:47紫蜘蛛
日期:2015-10-15 14:48:45九尾狐狸
日期:2015-09-22 15:53:22九尾狐狸
日期:2015-10-15 13:50:37九尾狐狸
日期:2015-10-15 14:45:48九尾狐狸
日期:2015-10-15 14:47:47九尾狐狸
日期:2015-10-15 14:48:45
17#
 楼主| 发表于 2010-12-24 15:06 | 只看该作者
Selenium Grid

http://www.oschina.net/p/selenium-grid

Selenium IDE是一个插件,而Selenium Grid是个测试工具,两者不要混淆了

使用道具 举报

回复
论坛徽章:
1309
ITPUB季度 技术新星
日期:2011-06-16 10:10:12海蓝宝石
日期:2012-04-03 16:46:37利物浦
日期:2023-02-13 12:39:45Heart of PUB
日期:2012-04-03 16:46:37指数菠菜纪念章
日期:2012-06-08 13:16:41季节之章:春
日期:2012-04-03 16:46:37季节之章:夏
日期:2012-04-03 16:46:37体育版块博采纪念徽章
日期:2008-07-03 19:47:13季节之章:秋
日期:2012-04-03 16:46:37季节之章:冬
日期:2012-04-03 16:46:37
18#
发表于 2010-12-24 15:27 | 只看该作者
原帖由 AlexQin 于 2010-12-24 15:06 发表
Selenium Grid

http://www.oschina.net/p/selenium-grid

Selenium IDE是一个插件,而Selenium Grid是个测试工具,两者不要混淆了

  

使用道具 举报

回复
论坛徽章:
1056
紫蜘蛛
日期:2015-09-22 15:53:22紫蜘蛛
日期:2015-10-15 13:48:52紫蜘蛛
日期:2015-10-15 14:45:48紫蜘蛛
日期:2015-10-15 14:47:47紫蜘蛛
日期:2015-10-15 14:48:45九尾狐狸
日期:2015-09-22 15:53:22九尾狐狸
日期:2015-10-15 13:50:37九尾狐狸
日期:2015-10-15 14:45:48九尾狐狸
日期:2015-10-15 14:47:47九尾狐狸
日期:2015-10-15 14:48:45
19#
 楼主| 发表于 2010-12-24 16:02 | 只看该作者
原帖由 michelle1011 于 2010-12-24 15:27 发表

  

  多点来,准备推荐你做下一季度的技术新星

使用道具 举报

回复
论坛徽章:
1309
ITPUB季度 技术新星
日期:2011-06-16 10:10:12海蓝宝石
日期:2012-04-03 16:46:37利物浦
日期:2023-02-13 12:39:45Heart of PUB
日期:2012-04-03 16:46:37指数菠菜纪念章
日期:2012-06-08 13:16:41季节之章:春
日期:2012-04-03 16:46:37季节之章:夏
日期:2012-04-03 16:46:37体育版块博采纪念徽章
日期:2008-07-03 19:47:13季节之章:秋
日期:2012-04-03 16:46:37季节之章:冬
日期:2012-04-03 16:46:37
20#
发表于 2010-12-24 23:46 | 只看该作者
原帖由 AlexQin 于 2010-12-24 16:02 发表

  多点来,准备推荐你做下一季度的技术新星


谢谢支持!

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表