Launch a .bat from Jenkins does not work

荒凉一梦 提交于 2021-01-28 18:00:30

问题


This is the .bat file :

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"

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

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.

The complete logs are here : http://img.prntscr.com/img?url=http://i.imgur.com/KsrEJiT.png

How can I make this .bat work with Jenkins?


回答1:


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 &"

instead of

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


来源:https://stackoverflow.com/questions/32243595/launch-a-bat-from-jenkins-does-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!