gpt4 book ai didi

javascript - 如何通过 Jenkins 运行 Dojo DOH 单元测试?

转载 作者:可可西里 更新时间:2023-11-01 01:34:27 26 4
gpt4 key购买 nike

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

我想执行以下操作,但如果已经完成,我不想重新发明它。所以,我在想:

  1. 在 Jenkins 中从构建后步骤开始 DOH 测试并等待结果
  2. 在 headless 浏览器(例如 Crowbar)中自行运行测试
  3. 从 Crowbar 返回的 HTML 中解析成功/错误计数
  4. 找到(或编写)一个 Jenkins 插件,它将 (a) 如果测试失败,则构建失败,(b) 呈现测试结果,(c) 可能将结果集成到 CI 游戏插件中

问题:

  1. 以前有人这样做过吗?
  2. 您是否发现上述大纲有任何问题?
  3. 您是否知道有 Jenkins 插件可以提供帮助,还是我必须自己构建?

最佳答案

1. Automated Dojo testing - DOH & Selenium-RC (罗伯政变 - 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。我觉得很合理。

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.

关于javascript - 如何通过 Jenkins 运行 Dojo DOH 单元测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5256334/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com