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. python中jsonpath模块的运用

    1. jsonpath介绍用来解析多层嵌套的json数据;JsonPath 是一种信息抽取类库,是从JSON文档中抽取指定信息的工具,提供多种语言实现版本,包括:Javascript, Python, ...

  2. Vue技术内幕 出去看看吧 挂载

    src\platforms\web\runtime\index.js 挂载 Vue.prototype.$mount = function ( el?: string | Element, hydra ...

  3. Centos7 安装 python2.7

    Centos7 安装 python 2.7.15 和 pip  1.先安装 GCC 包,如果没安装 GCC包 就输入以下命令行安装: (*注:以下记得使用 su 权限) yum install gcc ...

  4. ModuleNotFoundError: No module named '_sqlite3' -- python2.7 问题

    ModuleNotFoundError: No module named '_sqlite3' 运行python 工程出现上面这个问题,以为python安装中缺少这个依赖, 注python 2.7 首 ...

  5. Database学习 - mysql 视图/触发器/函数

  6. 【原创】大叔问题定位分享(24)hbase standalone方式启动报错

    hbase 2.0.2 hbase standalone方式启动报错: 2019-01-17 15:49:08,730 ERROR [Thread-24] master.HMaster: Failed ...

  7. java控台输入

    import java.util.Scanner;//访问util包的Scanner(控台输入) public class HelloWorld {public static void main(St ...

  8. Python知识目录

    目录 一.计算机基础 二.Python基础 三.函数 四.常用模块 五.模块和包 六.面向对象 七.网络编程socket 八.数据库 九.前端 十.Python Web框架 十一.版本控制--GIT ...

  9. Spring Boot 读取 resource 下文件

    支持linux下读取 import org.springframework.core.io.ClassPathResource; public byte[] getCertStream(String ...

  10. Datatables插件1.10.15版本服务器处理模式ajax获取分页数据实例解析

    一.问题描述 前端需要使用表格来展示数据,找了一些插件,最后确定使用dataTables组件来做. 后端的分页接口已经写好了,不能修改.接口需要传入页码(pageNumber)和页面显示数据条数(pa ...