如何通过詹金斯运行Dojo DOH单元测试? [英] How to run Dojo DOH unit-tests through Jenkins?

查看:137
本文介绍了如何通过詹金斯运行Dojo DOH单元测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人尝试过与Jenkins集成Dojo DOH单元测试?



我想做以下操作,但是如果这样做,不想重新创建已经完成所以,我在想:


  1. 从Jenkins的后期制作步骤启动DOH测试,等待结果

  2. 在无头浏览器(例如Crowbar)中运行测试本身

  3. 从Crowbar返回的HTML解析成功/错误计数

  4. 查找(或写)Jenkins插件,如果出现故障测试,将(a)失败构建,(b)呈现测试结果,(c)可能将结果集成到CI游戏插件中li>



问题:





  1. 你看到上面的大纲有任何问题吗?

  2. 你知道一个Jenkins插件,这将有助于或将要建立我自己?


解决方案

1。 自动Dojo测试 - DOH& Selenium-RC (Rob Coup - 2008/01/03)


计划:




  • 有一个配置文件定义要启动的浏览器,它们所在的机器以及要运行的测试。

  • 通过Selenium-RC启动每个浏览器

  • 通过正常的DOH浏览器运行器运行测试。

  • 使用Selenium从DOH中提取结果。

  • 整理各种浏览器的结果,并产生有用的东西。



解决方案:




  • 删除 seleniumRunner.js ,seleniumRunner.config.js,seleniumRunner.sh (或$ code> .bat 如果您在Windows)和在您的Dojo安装中,将selenium-java-client-driver.jar into util / doh /

  • selenium-server.jar ,然后运行 java -jar selenium-server.jar -multiWindow ,所以它监听浏览器 - 控制消息。

  • 编辑 seleniumRunner.config.js 并更改浏览器 rootUrl 以匹配您的设置。 rootUrl 需要从每个测试机器可访问。

  • 运行 ./ seleniumRunner.sh seleniumRunner.config

  • 它将加载配置,启动每台机器上的浏览器,然后在工作站上的 util / doh / 从Dojo核心运行单元测试,并打印每个测试的通过/失败/错误统计信息。

  • 每个浏览器都被单独的线程启动并监控(不是绝对必要但太酷



问题:




  • 除非我以多窗口模式运行selenium服务器,否则每当测试页面加载
    时,Firefox将弹出打印对话框(!?!)。但是,如果在
    multiWindow模式下,Safari从未初始化测试页。在OSX和Windows上。 gi。

  • OSX上的Opera没有正确设置Selenium代理( localhost:4444 供参考)。

  • 由于某种原因,IE不喜欢通过selenium javascript命令执行 dojo.connect()


2。对我来说似乎合理。



3。 Jenkins Selenium插件


此插件将您的Jenkins集群变成Selenium2网格集群
,以便您可以利用异构Jenkins集群携带
的硒测试。这个插件是一个交钥匙解决方案 - 不需要额外的
安装,也不需要配置来使其工作。
插件自动在所有的从站上安装Selenium网格,并自行设置
一个网格。



Has anyone tried integrating Dojo DOH unit-tests with Jenkins?

I'd like to do the following, but don't want to reinvent it if this has already been done. So, I'm thinking:

  1. Kick off the DOH-tests from a post-build step in Jenkins and wait for the results
  2. Run the tests themselves in a headless-browser (e.g. Crowbar)
  3. Parse the succes/error-count from the HTML returned by Crowbar
  4. Find (or write) a Jenkins plugin that will (a) fail the build if there are failing tests, (b) render the test results, (c) possibly integrate results into the CI game plugin

Questions:

  1. Has this been done before?
  2. Do you see any issues with the outline above?
  3. Do you know of a Jenkins plugin that will help, or will I have to build my own?

解决方案

1. Automated Dojo testing - DOH & Selenium-RC (Rob Coup - 2008/01/03)

Plan:

  • Have a config file defining which browsers to launch, which machines they're on, and what tests to run.
  • Launch each browser via Selenium-RC
  • Run the tests via the normal DOH browser runner.
  • Use Selenium to extract the results from DOH.
  • Collate the results from the various browsers and produce something useful.

Solution:

  • Drop seleniumRunner.js, seleniumRunner.config.js, seleniumRunner.sh (or the .bat if you're on Windows), and selenium-java-client-driver.jar into util/doh/ in your Dojo install.
  • Put selenium-server.jar on each test machine, then run java -jar selenium-server.jar -multiWindow so it listens for the browser-control messages.
  • Edit seleniumRunner.config.js and change browsers and rootUrl to match your setup. The rootUrl needs to be reachable from each test machine.
  • run ./seleniumRunner.sh seleniumRunner.config.js from util/doh/ on your workstation
  • It'll load the config, fire up the browsers on each machine, run the unit tests from Dojo core, and print the pass/fail/error stats for each.
  • Each browser is kicked off and monitored in a separate thread (not strictly necessary but too cool to resist doing).

Issues:

  • unless I ran the selenium server in multiWindow mode Safari and Firefox would pop up Print dialogs (!?!) whenever the test page was loaded. But Safari never initialised the test page if it was in multiWindow mode. On OSX and Windows. gah.
  • Opera on OSX didn't set up the Selenium proxy properly (localhost:4444 for reference).
  • IE didn't like doing a dojo.connect() via the selenium javascript commands for some reason.

2. Seems reasonable to me.

3. Jenkins Selenium plugin

This plugin turns your Jenkins cluster into a Selenium2 Grid cluster, so that you can utilize your heterogeneous Jenkins clusters to carry out Selenium tests. This plugin is a turn-key solution — no additional installation nor configuration is necessary to make it work. The plugin installs Selenium Grid on all the slaves automatically and set up a grid on its own.

这篇关于如何通过詹金斯运行Dojo DOH单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆