from http://forgetfulprogrammer.wordpress.com/tag/interact-with-desktop/

Running NetBeans application tests on Jenkins CI is quite easy. You just need to call the ‘test’ target in your NetBeans application’s build script (e.g. ANT build.xml) and Jenkins will do the rest. I initially setup Jenkins as a windows service to run my tests. This works fine for unit tests since they do not require a display to execute.

But recently I faced some issues when I wanted to run some functional (GUI) tests of a NetBeans platform app using a Jenkins job running on Windows. Since the Jenkins process could not access the windows display all the GUI tests were failing. On a linux box this issue is addressed by using X display such Xvnc (available as a Jenkins plugin), but of course I cannot use X display on windows!

After googling around I came across a possible solution which was to enable the option “Allow service to interact with desktop” for my Jenkins service. But as promising as it seemed it did not work, my GUI tests continued to fail 

Then I decided to stop and disable the Jenkins windows service and just ran it from the windows command prompt using the refreshingly simple command “java -jar jenkins.war”. Voila!!! It worked all my GUI tests were running without any problem and I can even see the GUIs opening and closing automagically on my windows desktop.

This solution was confirmed when I later stumbled upon the wiki here, which shows how to run GUI tests on ‘Hudson’ (Jenkins’ original name before Oracle knocked its head on a rock!) using a Tomcat container running on Windows. Although I didn’t use a servlet container such as Tomcat the solution applies to my situation as well.

So there you are, if you want to run GUI tests on Jenkins CI running onWindows do not configure it as a windows service instead run it from the command prompt or set it up as a scheduled task to run on windows logon using the command “java -jar jenkins.war”.

=====================

Finally, I found the real explanation from here:

http://wiki.hudson-ci.org/display/HUDSON/Tomcat

Tomcat from Windows

GUI Testing in Windows

Most Windows services -- including those run with the option "Allow service to interact with desktop" in Windows XP and Vista -- do not have access to many of the computer's resources, including the console display.  This may cause Automated GUI Tests to fail if you are running Apache Tomcat as a Windows Service and are doing any GUI testing. This is true at least for AWT and Abbot frameworks.  A typical error might look similar to this:

[junit] \# An unexpected error has been detected by HotSpot Virtual Machine:
[junit] \#
[junit] \# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d07baf4, pid=3260, tid=288
[junit] \#
[junit] \# Java VM: Java HotSpot(TM) Client VM (1.5.0_09-b03 mixed mode, sharing)
[junit] \# Problematic frame:
[junit] \# C [awt.dll+0xbaf4|awt.dll+0xbaf4]
[junit] \#

This limitation can be resolved by not running Tomcat as a Windows Service, but instead through a "Scheduled Task" as an Application that runs at logon. There are several options for doing this, an example would be  to run "$TOMCAT_HOME\bin\tomcat5.exe".  When setting up the scheduled task in Windows Vista consider choosing the check-box for "Run with highest privileges" from the general tab, as this removes the need to always provide administrator privileges and may resolve other issues as well.

*Note: This workaround/fix may or may not require an admin to be logged in during testing.  Running your tests while logged in as a standard user this is fine, but some modifications may need to be made for your individual configuration.

NetBeans GUI tests on Jenkins + Windows (转)的更多相关文章

  1. jenkins 'cordova' command not recognised on Jenkins Windows slave

    在jenkins里构建ionic项目.在构建Execute Windows bath command 执行 cordova 跟ionic 命令失败.但是运行cmd却能够执行成功. 惊不惊喜 意不意外, ...

  2. jenkins windows slave 构建c/c++代码

    关于如何再centos系统上的jenkins master下搭建windows系统的jenkins slave节点,本篇博客中不做介绍,如果有需要的话,请参考我的另外一篇博客,在其中介绍了不同系统的j ...

  3. jenkins windows执行批处理脚本总是失败

    使用jenkins 在使用编译vc++的一个项目,在执行批处理脚本的时候总是失败, 但是在控制台无论是管理员还是普通用户都能正常编译,jenkins每次都失败,看日志就是调用一个cmd命令直接失败,e ...

  4. jenkins+windows+springboot+.net项目自动化部署图文教程

    之前一直在linux中使用jenkins部署程序,正好现在的项目包括了winfrom程序,所以需要部署到windows系统中 jenkins官网:https://jenkins.io/ 下载之后运行j ...

  5. Jenkins windows部署

    1.安装jenkins 进入https://jenkins.io/download/,下载windows安装包,解压后运行jenkins.msi进行安装. 配置jenkins (1)打开http:// ...

  6. 持续集成高级篇之Jenkins windows/linux混合集群搭建(二)

    系列目录 前面我们说过,要使用ssh方式来配置windows从节点,如果采用ssh方式,则windows和linux配置从节点几乎没有区别,目前发现的惟一的区别在于windows从节点上目录要设置在c ...

  7. Jenkins windows 执行批量cmd命令XCOPY 提示'XCOPY' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

    由于Jenkins没有配置环境变量造成 打开Jenkins=>Manage Jenkins =>Configure System =>全局属性 新增全局变量 健: Path 值: % ...

  8. 在 Jenkins Windows Agent 节点上执行 Shell 命令

    Jenkins 在 Windows agent 上执行shell 命令,听起来很有意思,以下方法可以在 Jenkins 中执行一些简单的 shell 脚本,如果是复杂脚本就交给 Linux agent ...

  9. jenkins windows 2.204版,免安装,推荐插件齐备.

    windows专用,已安装好推荐插件, 更新了安装源为清华源,也就是说只要官方的插件,你都可以秒速下载了.香不? 解压到一个文件夹,管理员模式运行cmdcd 文件夹名jenkins install这样 ...

随机推荐

  1. Scrapy框架-----爬虫

    说明:文章是本人读了崔庆才的Python3---网络爬虫开发实战,做的简单整理,希望能帮助正在学习的小伙伴~~ 1. 准备工作: 安装Scrapy框架.MongoDB和PyMongo库,如果没有安装, ...

  2. 「luogu3313」[SDOI2014] 旅行

    题目大意 :有 n 个城市连成一棵树, 每个城市有两个关键字, 一个是该城市的宗教, 另一个是城市的评级;旅行者要在城市间旅行, 他只会在和自己宗教相同的城市留宿;维护四个树上操作 { 1. “CC ...

  3. 金三银四背后,一个 Android 程序员的面试心得

    回顾一下自己这段时间的经历,九月份的时候,公司通知了裁员,我匆匆忙忙地出去面了几家,但最终都没有拿到offer,我感觉今年的寒冬有点冷.到十二月份,公司开始第二波裁员,我决定主动拿赔偿走人.后续的面试 ...

  4. Mysql-innoDB存储引擎(事物,锁,MVCC)

    innoDB的特性: 从图中由上至下红色框中的信息是:基于主键的聚集索引 ,数据缓存,外键支持(逻辑上建立外键),行级别锁,MVCC多版本控制,事务支持.这些也是InnoDB最重要的特性. 事务: 数 ...

  5. Three teachers who make differences in my life

    人生路漫漫,从小到大,经历过九年义务教育的我们也受到过很多老师的熏陶,而已经进入大学的我也会回想起那些给我带来别样意义的老师们. 亲爱的老李-老李是我初中的班主任,也是我的历史老师.依稀记得上他的课会 ...

  6. CS DevExpress程序启动(主窗体初始化优化)

    在进入程序主界面时,某些情况下主界面的初始化会消耗很长时间,例如一些复杂的业务系统,可能会从服务器上下载最新的数据进行展示等等,在这种情况下,我们可以采用一个进度界面展示“系统正在加载...”,等主界 ...

  7. [转] 微信小程序之生命周期

    本篇文章介绍小程序的生命周期,由于小程序分为应用和页面两个部分,所以小程序的生命周期就涉及到三个部分,分别是: 应用的生命周期 页面的生命周期 应用的生命周期对页面生命周期的影响 一.应用的生命周期 ...

  8. 关闭 Window 之后,无法设置 Visibility,也无法调用 Show、ShowDialogor 或 WindowInteropHelper.EnsureHandle。

    参考网址: 1.WPF Tips: Window.ShowDialog()方法:Cannot set Visibility or call Show, ShowDialog, or WindowInt ...

  9. line-height:1.5和line-height:150%的区别

    1. 给你个数,孩子自己算吧  line-height:1.5 父元素设置line-height:1.5会直接继承给子元素,子元素根据自己的font-size再去计算子元素自己的line-height ...

  10. Python-简单的爬虫语句

    今天做一个简单的天气查询的程序,主要用到Urllib2(python自带的),和Json(Java Script Object Notation,JavaScript 对象表示法),安装步骤: jso ...