从詹金斯启动.bat无效 [英] Launch a .bat from Jenkins does not work

查看:90
本文介绍了从詹金斯启动.bat无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是.bat文件:

start cmd.exe /k "C:\Users\etudes.ext46\AppData\Local\Android\sdk1\tools\emulator.exe -avd ff &"
ping 127.0.0.1 -n 60 > nul
start cmd.exe /k "adb shell input keyevent 82"
start cmd.exe /k "node "C:\Program Files\Appium\node_modules\appium\bin\appium.js" -a 127.0.0.1 -p 4723 &"
ping 127.0.0.1 -n 30 > nul
C:\Users\etudes.ext46\Downloads\NUnit-2.6.4\NUnit-2.6.4\bin\nunit-console.exe C:\Users\etudes.ext46\Downloads\NUnit-2.6.4\NUnit-2.6.4\bin\apk\UnitTestProject1.dll
start cmd.exe /k "taskkill /F /IM emulator-x86.exe"
start cmd.exe /k "taskkill /F /IM node.exe"
start cmd.exe /k "taskkill /F /IM cmd.exe"

当我手动运行它时,它运行良好(模拟一个Android设备,并在Nunit测试中使用Appium).

When i run it manually, it works pretty well (emulate an android device an use Appium with Nunit tests).

但是当我尝试从Jenkins启动 exact 相同的.bat时,它不起作用

But when I try to launch the exact same .bat from Jenkins it doesn't work

Errors and Failures:
1) TearDown Error : AppiumSample.ASSI2.AssistanceV2
   SetUp : System.InvalidOperationException : A new session could not be created. (Original error: Could not find a connected Android device.) (33)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

完整的日志在这里: http: //img.prntscr.com/img?url=http://i.imgur.com/KsrEJiT.png

我如何使此.bat与Jenkins一起使用?

How can I make this .bat work with Jenkins?

推荐答案

解决方案是在启动模拟器时添加选项-no-window

The solution was to add the option -no-window when launching the emulator

start cmd.exe /k "C:\path\emulator.exe -avd ff -no-window &"

代替

start cmd.exe /k "C:\path\emulator.exe -avd ff &"

这篇关于从詹金斯启动.bat无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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